Skip to content
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

【Help】【H2】 manany request is pending #2503

Closed
silence-coding opened this issue Apr 15, 2021 · 8 comments
Closed

【Help】【H2】 manany request is pending #2503

silence-coding opened this issue Apr 15, 2021 · 8 comments
Labels
A-http2 Area: HTTP/2 specific. C-bug Category: bug. Something is wrong. This is bad!

Comments

@silence-coding
Copy link
Contributor

We use Hyper + Rustls to develop a proxy service as the entrance to the website. After H2 is enabled for the proxy service (other backend services do not enable H2), there is a possibility that a large number of pending pages may be generated. You must close all tabs of the browser before you can access it again. Strangely, the response header has been received in the pending request. When H2 is not enabled, there is no large number of pending requests.
image
image

Only these are the exception logs.:
[2021-04-15 22:06:13 WARN hyper::proto::h2 63] Connection header illegal in HTTP/2: connection
[2021-04-15 22:06:13 WARN hyper::proto::h2 63] Connection header illegal in HTTP/2: connection
[2021-04-15 22:06:13 WARN hyper::proto::h2 63] Connection header illegal in HTTP/2: connection
[2021-04-15 22:07:12 WARN hyper::proto::h2 45] Connection header illegal in HTTP/2: keep-alive
[2021-04-15 22:07:12 WARN hyper::proto::h2 63] Connection header illegal in HTTP/2: connection

@seanmonstar
Copy link
Member

Hm, strange. It's "pending" even though you've received the headers? Do they not include a status code? They probably do... How are you using hyper and h2? What version are you using, and how are you configuring the server?

@silence-coding
Copy link
Contributor Author

silence-coding commented Apr 16, 2021

I use the hyper server to receive the request from the browser and then forward the request to the backend service through the hyper client according to internal rules. If all use HTTP1/1, not found a large number of pending requests. However, when H2 is used from the browser to the hyper server and Http1/1 is used from the hyper client to the backend service, a large number of pending requests occasionally occur.

Hyper 0.13.7 tokio-rustls 0.13.1 tokio 0.2.13

configuring like that

server:

let incoming = hyper::server::accept::from_stream(incoming);
hyper::Server::builder(incoming)
        .http1_max_buf_size(sctx.accept.http1_max_buf_size)
        .http1_half_close(true)
        .serve(hyper::service::make_service_fn(service)
        .with_graceful_shutdown(xxx).await

client:
impl Service<Uri> for HttpConnector {
     type Response = HttpConnection;
}
impl Connection for HttpConnection {
   fn connected(&self) -> Connected {
        let c = Connected::new();
        if self.h2 {
            c.negotiated_h2()
        } else {
            c
        }
    }
}

@silence-coding
Copy link
Contributor Author

Firefox also has this problem.

@seanmonstar
Copy link
Member

Are all the requests using the same connection, or are they using different connections?

@silence-coding
Copy link
Contributor Author

silence-coding commented Apr 21, 2021

same connection, connection id is same

@davidpdrsn davidpdrsn added A-http2 Area: HTTP/2 specific. C-bug Category: bug. Something is wrong. This is bad! labels May 7, 2021
@silence-coding
Copy link
Contributor Author

silence-coding commented Nov 1, 2021

I've updated with more information on this issue at hyperium/h2#573

@silence-coding
Copy link
Contributor Author

@seanmonstar Can you help me see if my tests and guesses are correct?
According to the current test, the pending cause may be that the value of http2_initial_connection_window_size is smaller than the value of initial_stream_window_size. As a result, packets on a stream occupy the connection for a long time, and requests on other stream can only wait.

@silence-coding
Copy link
Contributor Author

It's a problem in H2, and I'm going to close the hyper issue.

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

No branches or pull requests

3 participants