Graceful shutdown never finishes
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.3k
- Forks
- 1.8k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 14
Description
Hey, I have an endpoint that shutdown will never finish when the server get the following error or overloaded:
[2020-10-01][14:52:50][hyper::server::tcp][ERROR] accept error: Too many open files (os error 24)
let graceful = server.with_graceful_shutdown(async {
rx.await.ok();
// still it reaches this line
});
if let Err(e) = graceful.await {
error!("error: {}, endpoint: {}", e, self.addr);
}
// but never reach this line when the server get `accept error / Too many open files`
I can also confirm that after the accept error and before the shutdown there are open connections left behind with state (using ss -t)
-
FIN-WAIT-1 0 2822 127.0.0.1:terabase 127.0.0.1:40830 -
LAST-ACK 0 1 127.0.0.1:40830 127.0.0.1:terabase -
FIN-WAIT-1 0 2822 127.0.0.1:terabase 127.0.0.1:40830
And after sending shutdown signal some connections get dropped but still some active with ESTAB state
ESTAB 0 0 127.0.0.1:terabase 127.0.0.1:57234
Also something important to mention that my application handles all requests that are passed to handle function and using atomic I was able to verify that no active API call left behind, so probably the issue is from hyper side whenever the server get overloaded or accept error
Thank you
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 server.with_graceful_shutdown entry point and reproduce the accept error: Too many open files with lingering ESTAB or closing connections. Trace why graceful.await does not complete after the shutdown signal; done means shutdown finishes even when the accept loop encounters this error and connections remain.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100