Skip to content

2024 09 18#1

Merged
randomizedcoder merged 1 commit into
mainfrom
2024_09_18
Sep 19, 2024
Merged

2024 09 18#1
randomizedcoder merged 1 commit into
mainfrom
2024_09_18

Conversation

@randomizedcoder

Copy link
Copy Markdown
Owner

No description provided.

@randomizedcoder randomizedcoder merged commit 3f820ed into main Sep 19, 2024
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>
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