Skip to content

server: drop stale ADS responses after unsubscribe - #1498

Merged
AntonKanug merged 2 commits into
envoyproxy:mainfrom
nezdolik:fix-ads-race
Jul 2, 2026
Merged

server: drop stale ADS responses after unsubscribe#1498
AntonKanug merged 2 commits into
envoyproxy:mainfrom
nezdolik:fix-ads-race

Conversation

@nezdolik

Copy link
Copy Markdown
Member

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.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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 A
  • Test B

Test Configuration:

  • Go Toolchain:

Checklist:

  • I have made corresponding changes to the changelog
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules
  • I've added sufficient test coverage for my change. If not, please explain why.

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]>
@nezdolik

nezdolik commented Jul 1, 2026

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread pkg/server/sotw/v3/server.go Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: Kateryna Nezdolii <[email protected]>
@AntonKanug
AntonKanug merged commit 1cd1226 into envoyproxy:main Jul 2, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants