shreemaan-abhishek opened a new pull request, #13572:
URL: https://github.com/apache/apisix/pull/13572

   ### Description
   
   The health check Control API (`GET /v1/healthcheck` and 
`/v1/healthcheck/{src_type}/{src_id}`) reads its node list straight from the 
health checker's shared dict via `healthcheck.get_target_list()`. That dict is 
keyed only by the upstream id, not by the node set, so when a node is removed 
from an upstream its target can linger there:
   
   - during the `delayed_clear` grace window after the checker is recreated, and
   - potentially indefinitely, since the cleanup sweep only runs for a checker 
that is present in the periodic-lock-holding worker's in-memory checker set.
   
   As a result the Control API keeps reporting nodes that are no longer part of 
the upstream, which is what #13385 reports.
   
   This patch reconciles the reported nodes against the upstream's current 
configuration in `extra_checker_info`, dropping any target whose `ip:port` is 
not in the current node set (taking the active-check port override into 
account). Matching is fail-open: if the configured node set cannot be 
determined, the original list is returned unchanged so a live node is never 
hidden.
   
   Fixes #13385
   
   ### Reproduce / verify
   
   Added `t/control/healthcheck-stale-nodes.t`: create an upstream with two 
nodes and an active health check, start the checker, delete one node via the 
Admin API, then query the Control API. Before the fix the deleted node is still 
returned; after the fix only the remaining node is reported.
   
   ### Checklist
   
   - [x] I have explained the need for this PR and the problem it solves
   - [x] I have explained the changes or the new features added to this PR
   - [x] I have added tests corresponding to this change
   - [x] I have updated the documentation to reflect this change
   - [x] I have verified that this change is backward compatible
   


-- 
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