Skip to content

Commit 1727429

Browse files
authored
chore: capture the error while create new healthchecker (#3213)
fix #3169
1 parent 9e2e5c8 commit 1727429

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

apisix/balancer.lua

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,17 @@ local function create_checker(upstream, healthcheck_parent)
8787
if healthcheck == nil then
8888
healthcheck = require("resty.healthcheck")
8989
end
90-
local checker = healthcheck.new({
90+
local checker, err = healthcheck.new({
9191
name = "upstream#" .. healthcheck_parent.key,
9292
shm_name = "upstream-healthcheck",
9393
checks = upstream.checks,
9494
})
9595

96+
if not checker then
97+
core.log.error("fail to create healthcheck instance: ", err)
98+
return
99+
end
100+
96101
local host = upstream.checks and upstream.checks.active and upstream.checks.active.host
97102
local port = upstream.checks and upstream.checks.active and upstream.checks.active.port
98103
for _, node in ipairs(upstream.nodes) do

0 commit comments

Comments
 (0)