quic: fix reader backpressure deadlock on idle connections#63950
Open
pimterry wants to merge 2 commits into
Open
quic: fix reader backpressure deadlock on idle connections#63950pimterry wants to merge 2 commits into
pimterry wants to merge 2 commits into
Conversation
Signed-off-by: Tim Perry <pimterry@gmail.com>
Collaborator
|
Review requested:
|
jasnell
reviewed
Jun 17, 2026
jasnell
approved these changes
Jun 17, 2026
Ethan-Arrowood
approved these changes
Jun 17, 2026
Co-authored-by: James M Snell <jasnell@gmail.com> Co-authored-by: Ethan Arrowood <ethan@arrowood.dev>
Member
Author
|
Suggestions applied, thanks both! I'll need a quick rereview when somebody has a sec please. |
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.
When we're not reading from a QUIC stream, inbound data will build up until it hits the stream flow control window, and then the remote peer will stop sending until we're ready to continue.
When we're ready, we call
session().ExtendStreamOffset(which callsngtcp2_conn_extend_max_stream_offset) to send aMAX_STREAM_DATAframe to the peer expanding the window, telling them they can send us more.Right now this doesn't always work: we call
ExtendStreamOffsetbut that only queues the frame, it doesn't actually send it. This is masked in most cases by other activity on most sessions that ends up sending the frame with it implicitly (most commonly acks).If you ever have an idle session though, and then you read a stream that's been blocked like this, the frame will never be sent, which deadlocks: you're waiting for more data, and the remote peer is waiting to be told it's allowed to send some.
This PR fixes that, by ensuring we always flush a send after we update the stream window.