Skip to content

Panic on graceful shutdown for http/1 #3615

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

Closed
DDtKey opened this issue Mar 30, 2024 · 0 comments · Fixed by #3616
Closed

Panic on graceful shutdown for http/1 #3615

DDtKey opened this issue Mar 30, 2024 · 0 comments · Fixed by #3616
Labels
C-bug Category: bug. Something is wrong. This is bad!

Comments

@DDtKey
Copy link
Contributor

DDtKey commented Mar 30, 2024

Version
Encountered with 1.x

Platform
Doesn't matter

Description

Attempt to call graceful_shutdown for H1 connection which is upgraded (=> Poll::Ready) leads to panic:

panic was raised: panicked at /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/hyper-1.2.0/src/server/conn/http1.rs:483:38:
called `Option::unwrap()` on a `None` value

The reason is this line:

Pin::new(self.inner.as_mut().unwrap()).graceful_shutdown()

When connection is Upgraded (& future is Ready), it's None

Ok(proto::Dispatched::Upgrade(pending)) => {
let (io, buf, _) = self.inner.take().unwrap().conn.into_inner();
pending.fulfill(Upgraded::new(io, buf));
Poll::Ready(Ok(()))
}

So we should avoid unwrapping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug. Something is wrong. This is bad!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant