Skip to content

Panic on graceful shutdown for http/1 #3615

Closed
@DDtKey

Description

@DDtKey

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: bug. Something is wrong. This is bad!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions