Repository navigation
main: bound GracefulStop so a hung stream cannot cost the access-state save - #73
Merged
shreyas-blacksmith merged 1 commit intoNov 2, 2026
Merged
Conversation
…e save One in-flight gRPC stream whose client has gone away held GracefulStop past systemd's TimeoutStopSec on a staging L1; the SIGKILL that followed skipped SaveAccessState. Drain for at most 10s, then Stop() the remaining connections so shutdown always reaches the save. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Summary
On bazel-l1-staging-2 (.17) a
systemctl stophung afterStopping gRPC server:grpcServer.GracefulStop()never returned, systemd SIGKILLed the process atTimeoutStopSec=30, andSaveAccessState(#72) never ran. GracefulStop waits for every in-flight stream to end and the fork sets no server keepalive, so a single stream whose client has gone away without closing it holds the drain forever. Traffic at the time was a trickle (one completed read in the 17 s before the signal), so this is a stuck stream, not load.stopGrpcServer(s, grpcGracefulStopTimeout)replaces the bare call in the signal handler:Idle or quickly-drained servers behave exactly as before (the second staging restart drained in ~1 s and saved/restored 14,901 entries). Only a drain that outlives 10 s is cut short, and the shutdown then still reaches the access-state save and the LRU observation drain well inside
TimeoutStopSec.Tests:
TestStopGrpcServerBoundsAHungStreamopens a bidi stream whose handler blocks until its context ends and assertsstopGrpcServerreturns after the bound;TestStopGrpcServerReturnsEarlyWhenIdlecovers the no-op path. Both run under-race.Link to Devin session: https://app.devin.ai/sessions/df6c6655558146b9bafe936b062e49e7
Open in Devin Desktop: https://app.devin.ai/desktop/session/df6c6655558146b9bafe936b062e49e7?variant=devin
Requested by: @shreyas-blacksmith
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.