Skip to content

stream: wait out Connecting before watching for GOAWAY - #365

Merged
meling merged 1 commit into
masterfrom
fix/364/goaway-watcher-connecting
Oct 13, 2026
Merged

meling merged 1 commit into
masterfrom
fix/364/goaway-watcher-connecting

Conversation

@meling

@meling meling commented Oct 13, 2026

Copy link
Copy Markdown
Member

Fixes #364.

watchGoAway treated any ClientConn state other than Ready as a GOAWAY.
Just after NodeStream returns, the state can still be Connecting, so a healthy session was drained and ended.
One-way messages that Send had accepted but gRPC had not yet written were lost, which made TestOnewayCalls flaky.

The watcher now waits for Connecting to pass first.

Verified: with a -race test binary, four concurrent -count=1000 runs of TestOnewayCalls failed almost every time before the change (instrumentation showed startDrain called in state CONNECTING) and passed 4/4 after.
No deterministic regression test: forcing the Connecting window needs a hook into gRPC internals.

watchGoAway drained a session as soon as the connection was not Ready.
Just after the stream opens, the ClientConn can still report Connecting,
so a healthy session was drained and ended at once. One-way messages
that Send had accepted but gRPC had not yet written were lost.

Wait for the connection to leave Connecting before treating a state
change as a server GOAWAY.

Closes: #364
Copilot AI balanced review requested due to automatic review settings October 13, 2026 00:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Only a non-blocking documentation nit remains.

0 open findings

🧠 Review effort: Lite

@meling
meling merged commit f21279e into master Oct 13, 2026
4 checks passed
@meling
meling deleted the fix/364/goaway-watcher-connecting branch October 13, 2026 09:54
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.

stream: flaky TestOnewayCalls loses one-way messages on a fresh connection

2 participants