Repository navigation
fix(http1): grant dispatch readiness once per request - #4247
Open
akasakariko wants to merge 2 commits into
Open
akasakariko wants to merge 2 commits into
akasakariko wants to merge 2 commits into
Conversation
Represent the initial buffer slot with a want and signal each subsequent want only once per receive cycle Do not restore readiness on Pending or withdraw a grant when dequeuing a request Extend the existing regression to check readiness while the request is still queued Fixes hyperium#4246
This branch has not been deployed
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.
Problem
Fixes #4246
In HTTP/1 dispatch,
SendRequestcan report readiness while a request is already queued or in flight, potentially causing a subsequent request to be canceledPreviously, the dispatch receiver signaled
wantwheneverpoll_recv()returnedPendingBecause
Pendingcan also occur when Tokio's cooperative budget is exhausted or a request is sent concurrently—not only when the queue is empty—this could restore readiness after the sender had already consumed itFurthermore, withdrawing the signal on dequeue could invalidate readiness that the sender had already observed
Changes
Pending, and initialize the channel with one grant so the first request can be sent immediatelybuffered_oncelogicTesting
Extended
h1_ready_in_flightto check bothpoll_ready()andis_ready()while a request is queued and in flightVerified that the False
SendRequestreadiness for HTTP/1 connections #4246 reproducer fails before the fix and passes afterwardPassed
cargo test --features full(328 passed, 10 ignored), Clippy,rustfmt, feature-powerset, MSRV, and semver checksThe description, docs, and comments (words meant for humans) are written by a human, not by an LLM.