-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(http2/client): avoid double-polling a Select future #3290
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, thanks for catching and providing the fix! <3
@@ -218,6 +221,8 @@ pin_project! { | |||
{ | |||
#[pin] | |||
conn: Either<Conn<T, B>, Connection<Compat<T>, SendBuf<<B as Body>::Data>>>, | |||
#[pin] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to pin a bool.
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
Select
future. Under some scheduling cases the future was polled multiple times, resulting in runtime panics:Closes: #3289