fix(http1): synchronize dispatch shutdown with sends - #4150
Open
fzlzjerry wants to merge 1 commit into
Open
Conversation
fzlzjerry
marked this pull request as ready for review
August 11, 2026 08:57
seanmonstar
requested changes
Aug 21, 2026
fzlzjerry
force-pushed
the
fix/h1-dispatch-race
branch
from
August 21, 2026 15:08
d5bcecb to
42dfc55
Compare
Drain a closed HTTP/1 dispatch channel until any concurrent synchronous send has either published or observed closure, so the queued request cannot remain owned by the sender. Closes hyperium#4122
fzlzjerry
force-pushed
the
fix/h1-dispatch-race
branch
from
August 21, 2026 15:16
42dfc55 to
333d33a
Compare
Contributor
Author
|
Updated the implementation in The new run passes the race regression, stable/beta/nightly tests, MSRV, minimal versions, Miri, features, docs, and the remaining checks. The sole red Linter job is Rust 1.98 reporting three new lints in untouched files ( |
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.
Fixes #4122.
Summary
Background
Tokio's unbounded channel reserves message capacity before it publishes the
envelope into the channel list. Receiver shutdown could close the channel and
observe a pending receive during that window. The send would then finish after
shutdown, leaving the request owned by the channel until the remaining
SendRequestwas dropped.After closing the receiver,
Pendingmeans that such a pre-close send is stillin flight. Retrying the existing single-poll receive until it yields the
envelope or reports the closed channel removes that window without introducing
an additional synchronization object. The HTTP/2 path remains unchanged.
Validation
cargo test --features full(309 passed, 10 ignored)cargo +1.97.1 clippy --features full -- -D warningscargo fmt --all -- --checkcargo check --no-default-features --features client,http1cargo check --no-default-features --features client,http2cargo check --no-default-features --features client,http1,http2cargo check --features full