fix(http2/client): avoid double-polling a Select future#3290
fix(http2/client): avoid double-polling a Select future#3290seanmonstar merged 3 commits intohyperium:masterfrom
Conversation
This reworks http2 client connection task in order to avoid storing a `Select` future. Under some scheduling cases the future was polled multiple times, resulting in runtime panics: ``` thread 'main' panicked at 'cannot poll Select twice', /index.crates.io/futures-util-0.3.28/src/future/select.rs:112:42 stack backtrace: [...] 5: <futures_util::future::select::Select<A,B> as core::future::future::Future>::poll 6: <hyper::proto::h2::client::H2ClientFuture<B,T> as core::future::future::Future>::poll [...] ```
|
@seanmonstar unfortunately I've only observed these panics on a remote service, but I didn't manage to easily reproduce it manually or through a test. I put together this patch based on the stacktrace and some educated guesses, but I'm not really familiar with this codebase. The code was introduced in #3184 by @Ruben2424, you may want to double-check this. |
Ruben2424
left a comment
There was a problem hiding this comment.
Thanks for the PR!
All in all, I'm not sure if this truly addresses the underlying issue or merely treats the symptoms.
As of my understanding the future should never be polled twice.
|
Alternatively I think we could also keep the |
seanmonstar
left a comment
There was a problem hiding this comment.
Makes sense, thanks for catching and providing the fix! <3
| { | ||
| #[pin] | ||
| conn: Either<Conn<T, B>, Connection<Compat<T>, SendBuf<<B as Body>::Data>>>, | ||
| #[pin] |
This reworks http2 client connection task in order to avoid storing a `Select` future. Under some scheduling cases the future was polled multiple times, resulting in runtime panics: ``` thread 'main' panicked at 'cannot poll Select twice', /index.crates.io/futures-util-0.3.28/src/future/select.rs:112:42 stack backtrace: [...] 5: <futures_util::future::select::Select<A,B> as core::future::future::Future>::poll 6: <hyper::proto::h2::client::H2ClientFuture<B,T> as core::future::future::Future>::poll [...] ``` Closes hyperium#3289
This reworks http2 client connection task in order to avoid storing a `Select` future. Under some scheduling cases the future was polled multiple times, resulting in runtime panics: ``` thread 'main' panicked at 'cannot poll Select twice', /index.crates.io/futures-util-0.3.28/src/future/select.rs:112:42 stack backtrace: [...] 5: <futures_util::future::select::Select<A,B> as core::future::future::Future>::poll 6: <hyper::proto::h2::client::H2ClientFuture<B,T> as core::future::future::Future>::poll [...] ``` Closes hyperium#3289
This reworks http2 client connection task in order to avoid storing a `Select` future. Under some scheduling cases the future was polled multiple times, resulting in runtime panics: ``` thread 'main' panicked at 'cannot poll Select twice', /index.crates.io/futures-util-0.3.28/src/future/select.rs:112:42 stack backtrace: [...] 5: <futures_util::future::select::Select<A,B> as core::future::future::Future>::poll 6: <hyper::proto::h2::client::H2ClientFuture<B,T> as core::future::future::Future>::poll [...] ``` Closes hyperium#3289
This reworks http2 client connection task in order to avoid storing a `Select` future. Under some scheduling cases the future was polled multiple times, resulting in runtime panics: ``` thread 'main' panicked at 'cannot poll Select twice', /index.crates.io/futures-util-0.3.28/src/future/select.rs:112:42 stack backtrace: [...] 5: <futures_util::future::select::Select<A,B> as core::future::future::Future>::poll 6: <hyper::proto::h2::client::H2ClientFuture<B,T> as core::future::future::Future>::poll [...] ``` Closes hyperium#3289
This reworks http2 client connection task in order to avoid storing a `Select` future. Under some scheduling cases the future was polled multiple times, resulting in runtime panics: ``` thread 'main' panicked at 'cannot poll Select twice', /index.crates.io/futures-util-0.3.28/src/future/select.rs:112:42 stack backtrace: [...] 5: <futures_util::future::select::Select<A,B> as core::future::future::Future>::poll 6: <hyper::proto::h2::client::H2ClientFuture<B,T> as core::future::future::Future>::poll [...] ``` Closes hyperium#3289 Signed-off-by: Sven Pfennig <[email protected]>
This reworks http2 client connection task in order to avoid storing a
Selectfuture. Under some scheduling cases the future was polled multiple times, resulting in runtime panics:Closes: #3289