cloudflare/pingora

On shutdown Pingora always sleep for `graceful_shutdown_timeout_seconds`

Opened this issue · 0 comments

Describe the bug

On shutdown Pingora always sleep for graceful_shutdown_timeout_seconds, regardless how quick all the tokio had runtimes finished. Problematic code is here:

let shutdowns: Vec<_> = runtimes
.into_iter()
.map(|(rt, name)| {
info!("Waiting for runtimes to exit!");
let join = thread::spawn(move || {
rt.shutdown_timeout(shutdown_timeout);
thread::sleep(shutdown_timeout)
});
(join, name)
})
.collect();

Pingora correctly waits for runtime to shutdown, but then for some reason adds thread::sleep for the same amount which doesn't make any sense I think.

Pingora info

Please include the following information about your environment:

Pingora version: Master
Rust version: doesn't matter
Operating system version: doesn't matter

Steps to reproduce

Do a Pingora reload and set graceful_shutdown_timeout_seconds to 10 minutes, even empty without any services old server will die exactly after that amount of time.

Expected results

As it's a timeout, I was expecting Pingora to stop as soon as all runtimes has finished.