Repository navigation
Stop a rejected stream from drawing shared calls off the pool - #38
Merged
Merged
Conversation
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.
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.
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.
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.