Gracefully shutting down a server connection that uses http2_keepalive_* errors with keepalive timeout
Open
Nobody has claimed this yet.
C-bug
- Dominant language
- Rust
- Stars
- 16.3k
- Forks
- 1.8k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 14
Description
Version
hyper v0.14.23
h2 v0.3.14
Platform
Linux 5.11.22
Description
When gracefully shutting down a server http connection, if http2_keepalive_* options are set, then it will sometimes error with an h2 keepalive timeout before shutting down properly.
let mut http_server = hyper::server::conn::Http::new();
http_server.http2_keep_alive_timeout(tcp_idle_timeout / 2);
http_server.http2_keep_alive_interval(tcp_idle_timeout / 2);
http_server.http2_max_concurrent_streams(32);
http_server.http2_only(true);
let mut http_server = http_server.serve_connection(ingress, http_svc).with_upgrades();
// not shown: poll the connection
// not shown: receive a signal telling us to gracefully terminate connections
Pin::new(&mut http_server).graceful_shutdown();
match http_server.await {
Ok(_) => {},
Err(e) => {
// `e` can sometimes be an `h2` keepalive timeout error
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Http::new(), http2_keep_alive_timeout(), http2_keep_alive_interval(), serve_connection().with_upgrades(), and graceful_shutdown() entry points shown in the report. Reproduce the HTTP/2 shutdown with keepalive settings and verify that graceful termination completes without returning an h2 keepalive timeout error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design, networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100