This is an automated email from the ASF dual-hosted git repository.
membphis 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 1727429 chore: capture the error while create new `healthchecker`
(#3213)
1727429 is described below
commit 17274295bc496050d9c8a834fde01be8b8b4628c
Author: dabue <[email protected]>
AuthorDate: Mon Jan 11 16:22:40 2021 +0800
chore: capture the error while create new `healthchecker` (#3213)
fix #3169
---
apisix/balancer.lua | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/apisix/balancer.lua b/apisix/balancer.lua
index d80cb67..8523317 100644
--- a/apisix/balancer.lua
+++ b/apisix/balancer.lua
@@ -87,12 +87,17 @@ local function create_checker(upstream, healthcheck_parent)
if healthcheck == nil then
healthcheck = require("resty.healthcheck")
end
- local checker = healthcheck.new({
+ local checker, err = healthcheck.new({
name = "upstream#" .. healthcheck_parent.key,
shm_name = "upstream-healthcheck",
checks = upstream.checks,
})
+ if not checker then
+ core.log.error("fail to create healthcheck instance: ", err)
+ return
+ end
+
local host = upstream.checks and upstream.checks.active and
upstream.checks.active.host
local port = upstream.checks and upstream.checks.active and
upstream.checks.active.port
for _, node in ipairs(upstream.nodes) do