Unexpected behavior of shutdown and grace period [help wanted]
Closed this issue · 3 comments
Hi everyone!
I'm trying to set up a reverse proxy with Pingora as a proof of concept.
So far, everything is working fine, but I'm experiencing a behavior where, once the process starts, it automatically shuts down for 300 seconds.
INFO Graceful shutdown: grace period 300s starts
I tried to find a way to disable this behavior, but I didn't see anything in the ServerConf documentation that would allow me to disable it, only to change the grace period.
este es el codigo dentro de main
`let mut proxy_service: Service<HttpProxy> =
http_proxy_service(&server.configuration, proxy);
proxy_service.add_tcp(&config.server.http_addr);
info!(addr = %config.server.http_addr, "HTTP listener configured");
proxy_service.add_tcp(&config.server.https_addr);
info!(addr = %config.server.https_addr, "HTTPS listener configured");
server.add_service(proxy_service);
let api: AdminApi = AdminApi::new(db.clone(), tls_manager.clone());
info!("Admin API initialized");
info!("Host-Proxy started successfully!");
info!("HTTP listening on {}", config.server.http_addr);
info!("HTTPS listening on {}", config.server.https_addr);
server.run_forever();`
Is there any way to disable it?
OS: Windows 11
PS: Something new in Rust, just getting back into it a while ago; the project with Pingora was a great excuse.
@Facundo15 I have no idea about running on windows, but I adjust the grace period in the example attached to: #694 which might at least point you in the right direction....
@Facundo15 This behavior is because on windows there is currently no blocking main loop that awaits a shutdown signal; graceful shutdown is automatically selected, and shutdown begins.
There is an open MR for the issue you're experiencing as well #425.
@Hyrum-Coleman Thank you for your response; I hadn't found that PR. Luckily, the target platform is Linux, but it was very annoying that the server kept shutting down.
@mgs255 I will definitely use an excessively long grace period for now so that it doesn't interfere with development.