2024 09 18#1
Merged
Merged
Conversation
randomizedcoder
added a commit
that referenced
this pull request
May 18, 2026
…backoff sleeps
Three related bugs in stream() and singleStreamingClient():
1. Inverted ResourceExhausted condition.
stream's err branch did `if status.Code(err) != codes.ResourceExhausted {
...backoff... }` — the comment + log message said "Received
ResourceExhausted error" but the condition fires for every OTHER
gRPC error. The actual ResourceExhausted case fell through to
`printFlatRecordsResponse(flatRecordsResponse, ...)` with a nil
response (Recv had returned err so flatRecordsResponse was nil).
That printed garbage at debug>10 and never did the documented
backoff.
Fix: flip the condition so ResourceExhausted is the special case
(backoff + retry), and any other err just continues to the next
iteration without a print.
2. printFlatRecordsResponse never called on success.
The orphaned print call lived inside the err branch (#1). The
happy path Recv'd a record and then... did nothing with it. The
xtcp2client tool effectively never printed anything received.
Fix: call printFlatRecordsResponse at the bottom of each iter on
the success path.
3. time.Sleep in two reconnect/backoff paths ignored ctx.
singleStreamingClient's reconnect loop and stream's
ResourceExhausted backoff both did time.Sleep, blocking Ctrl-C
shutdown for up to reconnectTime + jitter (or
ResourceExhaustedSleepTime + jitter). Replaced with
`select { ctx.Done; time.After }`.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
No description provided.