server: drop stale ADS responses after unsubscribe - #1498
Conversation
In ordered ADS, all type watches share a response channel. A response from a superseded watch can be queued after Envoy has updated the same type subscription, such as SDS teardown replacing a named Secret watch with an empty Secret watch. Filter responses against the current subscription before sending them so stale responses are dropped instead of reaching clients as unwatched resources. Add a regression test covering a stale Secret response after unsubscribe. Signed-off-by: Kateryna Nezdolii <[email protected]>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a mechanism to drop stale responses in the State-of-the-World (SotW) gRPC server when a client has unsubscribed from those resources. This is achieved by checking if the returned resources match the current subscription (including wildcard, exact names, and prefixes) before sending the response. A corresponding unit test was added to verify this behavior. Feedback suggests defensively checking if resp.GetRequest() is nil before calling GetTypeUrl() to prevent potential nil pointer dereferences.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> Signed-off-by: Kateryna Nezdolii <[email protected]>
Description
In ordered ADS, all type watches share a response channel. A response from a superseded watch can be queued after Envoy has updated the same type subscription, such as SDS teardown replacing a named Secret watch with an empty Secret watch.
Filter responses against the current subscription before sending them so stale responses are dropped instead of reaching clients as unwatched resources.
#
Type of change
Please delete options that are not relevant.
How has this been tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Test Configuration:
Checklist: