diff --git a/apisix/core/config_util.lua b/apisix/core/config_util.lua index 7e57ed402fd8..7313e0116ad2 100644 --- a/apisix/core/config_util.lua +++ b/apisix/core/config_util.lua @@ -114,7 +114,7 @@ function _M.fire_all_clean_handlers(item) clean_handler.f(item) end - item.clean_handlers = nil + item.clean_handlers = {} end diff --git a/apisix/upstream.lua b/apisix/upstream.lua index 0ff82fea856a..d8e3f3a98750 100644 --- a/apisix/upstream.lua +++ b/apisix/upstream.lua @@ -83,7 +83,7 @@ _M.set = set_directly local function release_checker(healthcheck_parent) local checker = healthcheck_parent.checker core.log.info("try to release checker: ", tostring(checker)) - checker:clear() + checker:delayed_clear(3) checker:stop() end diff --git a/t/node/healthcheck-leak-bugfix.t b/t/node/healthcheck-leak-bugfix.t index d3ada8c171f7..1caf5d348abf 100644 --- a/t/node/healthcheck-leak-bugfix.t +++ b/t/node/healthcheck-leak-bugfix.t @@ -31,8 +31,8 @@ __DATA__ local new = healthcheck.new healthcheck.new = function(...) local obj = new(...) - local clear = obj.clear - obj.clear = function(...) + local clear = obj.delayed_clear + obj.delayed_clear = function(...) ngx.log(ngx.WARN, "clear checker") return clear(...) end