fix(http1): synchronize dispatch shutdown with sends - #4150
Conversation
42dfc55 to
333d33a
Compare
|
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 ( |
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
333d33a to
1f3b285
Compare
|
Rebased this onto current |
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