Skip to content

'assertion failed: self.upgrade.is_none()' when reusing connection with ignored upgrade header #2114

Closed
@ggriffiniii

Description

@ggriffiniii

Hyper threads panic (though the server remains running) when a client makes multiple requests with an upgrade header (which hyper ignores). The first request is handled without issue, but when the second request is made the hyper thread panics and the connection is terminated.

Steps to reproduce:

  • Run the hello world example
    • cargo run --example hello
  • issue multiple requests over the same connection with an Upgrade header.
  • curl -v -H "Connection: Upgrade" -H "Upgrade: foo" http://127.0.0.1:3000 http://127.0.0.1:3000

The hyper output:

Listening on http://127.0.0.1:3000
thread 'main' panicked at 'assertion failed: self.upgrade.is_none()', src/proto/h1/conn.rs:905:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

The curl output:

*   Trying 127.0.0.1:3000...
* TCP_NODELAY set
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to 127.0.0.1 (127.0.0.1) port 3000 (#0)
> GET / HTTP/1.1
> Host: 127.0.0.1:3000
> User-Agent: curl/7.66.0
> Accept: */*
> Connection: Upgrade
> Upgrade: foo
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< content-length: 12
< date: Thu, 23 Jan 2020 23:45:26 GMT
< 
{ [12 bytes data]

100    12  100    12    0     0  12000      0 --:--:-- --:--:-- --:--:-- 12000
* Connection #0 to host 127.0.0.1 left intact
Hello World!* Found bundle for host 127.0.0.1: 0x5649a99f0170 [serially]
* Can not multiplex, even if we wanted to!
* Re-using existing connection! (#0) with host 127.0.0.1
* Connected to 127.0.0.1 (127.0.0.1) port 3000 (#0)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0> GET / HTTP/1.1
> Host: 127.0.0.1:3000
> User-Agent: curl/7.66.0
> Accept: */*
> Connection: Upgrade
> Upgrade: foo
> 
* Connection died, retrying a fresh connect

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
* Closing connection 0
* Issue another request to this URL: 'http://127.0.0.1:3000/'
* Hostname 127.0.0.1 was found in DNS cache
*   Trying 127.0.0.1:3000...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 3000 (#1)
> GET / HTTP/1.1
> Host: 127.0.0.1:3000
> User-Agent: curl/7.66.0
> Accept: */*
> Connection: Upgrade
> Upgrade: foo
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< content-length: 12
< date: Thu, 23 Jan 2020 23:45:26 GMT
< 
{ [12 bytes data]

100    12  100    12    0     0  12000      0 --:--:-- --:--:-- --:--:-- 12000
* Connection #1 to host 127.0.0.1 left intact
Hello World!

You can see that the connection dies when the second request is issued (corresponding to the panic in the hyper output), curl then establishes a new connection and reissues the request which succeeds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-http1Area: HTTP/1 specific.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