Apply backpressure before reading more frames - #344
Merged
seanmonstar merged 2 commits intoAug 7, 2026
Merged
Conversation
Decode complete buffered frames before polling the QUIC transport again. This bounds FrameStream buffering to the current transport chunk under a slow consumer.
Member
|
This looks good to me, reason it's still a draft? |
Streetblock
marked this pull request as ready for review
August 7, 2026 20:28
Contributor
Author
|
Oops, my bad! Leaving it as a draft was just an oversight. I just marked it as ready for review. Thanks! |
seanmonstar
approved these changes
Aug 7, 2026
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.
Summary
Decode complete frames already present in
FrameStream's receive buffer before polling the underlying QUIC transport for another chunk.This prevents a slow frame consumer from causing
BufRecvStreamto accumulate a new transport chunk on every wake while complete frames are still buffered.Root cause
FrameStream::poll_nextcalledtry_recvbefore attempting to decode the existing buffer. If one transport chunk contained multiple HTTP/3 frames, every subsequent frame poll could read and append another chunk before consuming the frames already available.Regression test
The new deterministic test models 64 immediately available transport chunks, each containing 16 HEADERS frames with a 1,024-byte payload, while the consumer processes one frame per wake.
On current
master, the test observed:With this change:
Validation
cargo fmt --all -- --checkcargo test -p h3 -p h3-quinnPrior and related work
After opening this draft, I noticed the issue timeline links to 0x676e67/http3#2. That June 2026 fork patch already contains the equivalent
FrameStreamreordering and a smaller two-frame regression test, alongside unrelated QPACK changes. Credit to @0x676e67 for that earlier implementation.This draft was developed independently against current upstream
master; its additional contribution is the stronger multi-chunk regression scenario and measured baseline above. Maintainers may prefer to adapt the earlier commit or this focused patch, and I am happy to adjust attribution or approach accordingly.The same regression scenario also passes on the broader receive-buffer refactor in #328. This draft offers a smaller near-term change while that larger design is evaluated.
Fixes #308