Repository navigation
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 ( |
333d33a to
1f3b285
Compare
|
Rebased this onto current |
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
1f3b285 to
6663880
Compare
| Some(Some(mut env)) => env.0.take(), | ||
| _ => None, | ||
| loop { | ||
| match crate::common::task::now_or_never(self.inner.recv()) { |
There was a problem hiding this comment.
This will check the task budget in Tokio, and could cause the loop to spin forever. We probably could just use the mpsc channel's try_recv() call in a loop instead, that won't use the budget since it's not a future.
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