shreemaan-abhishek commented on code in PR #13592:
URL: https://github.com/apache/apisix/pull/13592#discussion_r3466060803


##########
apisix/healthcheck_manager.lua:
##########
@@ -247,17 +254,34 @@ local function timer_working_pool_check()
                 --- callback construct_upstream to create an upstream 
dynamically
                 local upstream_constructor_config = jp.value(res_conf.value, 
json_path)
                 local plugin = require("apisix.plugins." .. plugin_name)
-                upstream = 
plugin.construct_upstream(upstream_constructor_config)
-                upstream.resource_key = resource_path
+                ok, upstream, err = pcall(plugin.construct_upstream, 
upstream_constructor_config)

Review Comment:
   Good catch, thanks. You're right that retaining on every failure would leak 
a checker when the instance/plugin is genuinely removed. Fixed: the retain is 
now gated on `upstream_constructor_config ~= nil`, so a nil constructor config 
(json path no longer resolves) is treated as a real removal and the checker is 
destroyed, while a transient `construct_upstream` failure still keeps it. Added 
a regression test that removes the plugin from the route and asserts the stale 
checker is released.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to