Skip to content

Stop a rejected stream from drawing shared calls off the pool - #38

Merged
liran merged 3 commits into
mainfrom
fix/rejected-stream-stays-in-pool
Nov 5, 2026
Merged

liran merged 3 commits into
mainfrom
fix/rejected-stream-stays-in-pool

Conversation

@liran

@liran liran commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

A stream a draining server rejected could stay selectable in the shared pool, so single-record calls skipped shared streams and each opened their own, and half of those reached the draining server. One race left the stream there dead until it expired, up to a minute; the other lasted until its receiver ran. This also explains the long-standing flake in TestRejectedProbeDoesNotHoldCallsOnADrainingServer.

Receiving now starts only once the group holds the stream, and a record a stream hands back after Send reports its end waits for the receiver, so the stream has left its group and any refusal counts before the record tries again. Each race has a deterministic test that fails without its fix.

A stream a server rejected at once could stay selectable in two ways. Its
receiver could end it before open added it to the group, leaving it there
dead until it expired. Or Send could report its end before the receiver
ran, so records handed back chose it again until their attempts ran out.

Either way calls fell back to streams of their own and kept reaching the
draining server. Receiving now starts once the group holds the stream, and
a stream leaves its group as soon as Send reports its end.
@liran liran self-assigned this Nov 5, 2026
liran added 2 commits November 5, 2026 20:46
Removing the stream as soon as Send reported its end left its refusal
unrecorded, so a retry could ask for the same draining server, now the one
with the fewest streams. Waiting for the receiver settles both at once.
@liran
liran merged commit 045b679 into main Nov 5, 2026
3 checks passed
@liran
liran deleted the fix/rejected-stream-stays-in-pool branch November 5, 2026 13:09
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