Skip to content

xds: Fix shutdownNow() becoming a no-op after shutdown() - #12982

Open
martinbaillie wants to merge 1 commit into
grpc:masterfrom
martinbaillie:xds/fix-shutdownnow-noop
Open

xds: Fix shutdownNow() becoming a no-op after shutdown()#12982
martinbaillie wants to merge 1 commit into
grpc:masterfrom
martinbaillie:xds/fix-shutdownnow-noop

Conversation

@martinbaillie

Copy link
Copy Markdown

This fixes XdsServerWrapper.shutdownNow() silently doing nothing once shutdown() had already been called, permanently hanging threads blocked in start(). Previously they shared a single guard flag, meaning whichever was called first made the other a complete no-op.

The fix gives shutdownNow()'s forceful-only work its own independent guard, following the same two-guard pattern already used by ManagedChannelImpl/ServerImpl in grpc-java core, so it always runs exactly once regardless of call order.

Includes a regression test that reproduces the hang against the old code and passes against the fix.

This fixes `XdsServerWrapper.shutdownNow()` silently doing nothing once `shutdown()` had already
been called, permanently hanging threads blocked in `start()`. Previously they shared a single guard
flag, meaning whichever was called first made the other a complete no-op.

The fix gives `shutdownNow()`'s forceful-only work its own independent guard, following the same
two-guard pattern already used by `ManagedChannelImpl`/`ServerImpl` in grpc-java core, so it always
runs exactly once regardless of call order.

Includes a regression test that reproduces the hang against the old code and passes against the fix.

Signed-off-by: Martin Baillie <martin@baillie.id>
@martinbaillie martinbaillie changed the title xds: Fix shutdownNow() becoming a no-op after shutdown()` xds: Fix shutdownNow() becoming a no-op after shutdown() Aug 11, 2026
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.

1 participant