Repository navigation
Ingester client: release the gRPC connection when stream setup fails - #7969
Open
arpitjain099 wants to merge 1 commit into
Open
arpitjain099 wants to merge 1 commit into
arpitjain099 wants to merge 1 commit into
Conversation
MakeIngesterClient returned the error from Run without closing the connection or cancelling the stream context, so a discarded client left a connection reconnecting to the ingester address for the lifetime of the process. Nothing could reach it, because ring/client.Pool only records a client once the factory has succeeded. Run also stored the workers' error in a plain variable written by all of them concurrently, which the race detector reports. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
arpitjain099
force-pushed
the
fix/ingester-client-leak-on-stream-setup-failure
branch
from
November 25, 2026 11:08
a3072da to
e3bef13
Compare
This branch has not been deployed
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.
What this PR does:
With
-distributor.use-stream-pushenabled,MakeIngesterClientopens the gRPC connection before it starts the push-stream workers. If starting them fails it returns the error without closing that connection or cancelling the stream context.ring/client.Poolonly records a client after the factory succeeds, so nothing is left holding the connection and nothing can ever close it, and its reconnect loop keeps dialing the ingester address until the process exits. The failures cluster while an ingester's address is still in the ring but already unreachable, so each rollout leaks a burst of them, and a querier reaches the same factory from the read path.The error path now cancels the stream context and closes the connection.
Runalso collected the workers' error in a plain variable written by all 100 of them, whichgo test -racereports, so it is now anatomic.Erroras inpkg/ring/batch.go.The new test drives
MakeIngesterClientagainst an address that refuses connections and fails on master.I used Claude Code while preparing this, and I have reviewed and tested the change myself.
Which issue(s) this PR fixes:
Fixes #7759
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]docs/configuration/v1-guarantees.mdupdated if this PR introduces experimental flags