fix(dispatch): close secondary grpc connections on shutdown#3141
Open
immanuwell wants to merge 1 commit into
Open
fix(dispatch): close secondary grpc connections on shutdown#3141immanuwell wants to merge 1 commit into
immanuwell wants to merge 1 commit into
Conversation
|
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
authzedbot
added a commit
to authzed/cla
that referenced
this pull request
May 28, 2026
tstirrat15
reviewed
May 28, 2026
tstirrat15
left a comment
Contributor
There was a problem hiding this comment.
The overall gist makes sense to me. Is it possible to write a unit test that captures this behavior, perhaps using a goleak assertion?
| } | ||
|
|
||
| func (cr *clusterDispatcher) Close() error { | ||
| var firstErr error |
Contributor
There was a problem hiding this comment.
Prefer errors.Join here
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
miparnisari
reviewed
May 28, 2026
Contributor
There was a problem hiding this comment.
Thanks for your contribution! This LGTM, but I have a few questions:
- can you update CHANGELOG.md under
[unreleased]? - how did you notice this behavior?
- (for the maintainers): we use the
goleakdetector right now, I wonder why this wasn't caught - (for the maintainers): this code has zero coverage 😱 https://app.codecov.io/gh/authzed/spicedb/blob/main/internal%2Fdispatch%2Fcombined%2Fcombined.go#L302
4067dc5 to
679f3f5
Compare
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.
SecondaryDispatch only stored the client interface, not the underlying conn, so Close() left secondary grpc connections dangling on shutdown.
Added a Conn field to SecondaryDispatch, stored it in combined.go, and updated Close() to drain secondaries before the primary. Field is nil-safe so test doubles are unaffected.
To reproduce: start with --dispatch-secondary-upstream-addr, shut down cleanly, secondary grpc goroutines (keep-alive etc) outlive the shutdown sequence.