You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2022/09/22 13:51:20 UTC

[apisix] branch master updated: fix(etcd): avoid error "connect() to .../config_listen.sock failed" (#7969)

This is an automated email from the ASF dual-hosted git repository.

spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 79793b140 fix(etcd): avoid error "connect() to .../config_listen.sock failed" (#7969)
79793b140 is described below

commit 79793b140cb08b743c90751b81437de20f8f919f
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Thu Sep 22 21:51:09 2022 +0800

    fix(etcd): avoid error "connect() to .../config_listen.sock failed" (#7969)
---
 apisix/core/etcd.lua              | 5 +++--
 rockspec/apisix-master-0.rockspec | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/apisix/core/etcd.lua b/apisix/core/etcd.lua
index f6b1ddbd5..d75a41916 100644
--- a/apisix/core/etcd.lua
+++ b/apisix/core/etcd.lua
@@ -25,6 +25,7 @@ local v3_adapter        = require("apisix.admin.v3_adapter")
 local etcd              = require("resty.etcd")
 local clone_tab         = require("table.clone")
 local health_check      = require("resty.etcd.health_check")
+local pl_path           = require("pl.path")
 local ipairs            = ipairs
 local setmetatable      = setmetatable
 local string            = string
@@ -183,8 +184,8 @@ local function switch_proxy()
     if not etcd_cli.unix_socket_proxy then
         return etcd_cli, prefix, err
     end
-    local sock = ngx_socket_tcp()
-    local ok = sock:connect(etcd_cli.unix_socket_proxy)
+    local sock_path = etcd_cli.unix_socket_proxy:sub(#"unix:" + 1)
+    local ok = pl_path.exists(sock_path)
     if not ok then
         return new_without_proxy()
     end
diff --git a/rockspec/apisix-master-0.rockspec b/rockspec/apisix-master-0.rockspec
index da9991485..5fa057bb4 100644
--- a/rockspec/apisix-master-0.rockspec
+++ b/rockspec/apisix-master-0.rockspec
@@ -34,7 +34,7 @@ dependencies = {
     "lua-resty-ctxdump = 0.1-0",
     "lua-resty-dns-client = 6.0.2",
     "lua-resty-template = 2.0",
-    "lua-resty-etcd = 1.8.3",
+    "lua-resty-etcd = 1.9.0",
     "api7-lua-resty-http = 0.2.0",
     "lua-resty-balancer = 0.04",
     "lua-resty-ngxvar = 0.5.2",