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

Pingora graceful shutdown sequence and app readiness/healthcheck endpoint #505

Open
deorus opened this issue Jan 8, 2025 · 2 comments
Open

Comments

@deorus
Copy link

deorus commented Jan 8, 2025

I'm using Pingora v0.4.0 to build an HTTP app and I want the readiness probe endpoint handled by the app (/.healthz/ready) to return non-200 status code if its in a period of a graceful shutdown.

However, when the shutdown starts, all listening services' listeners stop immediately:

2025-01-07T23:42:59.993176Z  INFO pingora_core::server: SIGTERM received, gracefully exiting
2025-01-07T23:42:59.993294Z  INFO pingora_core::server: Broadcasting graceful shutdown
2025-01-07T23:42:59.993377Z  INFO pingora_core::server: Graceful shutdown started!
2025-01-07T23:42:59.993396Z  INFO pingora_core::server: Broadcast graceful shutdown complete
2025-01-07T23:42:59.993440Z  INFO pingora_core::server: Graceful shutdown: grace period 60s starts
2025-01-07T23:42:59.993749Z  INFO pingora_core::services::listening: Shutting down 0.0.0.0:3000
2025-01-07T23:42:59.994083Z  INFO pingora_core::server: service exited.

Any suggestions to work around it?

@xushichangdesmond
Copy link

ah ok i found it, its there set_read_timeout and set_write_timeout in the HttpSession.

@deorus
Copy link
Author

deorus commented Jan 8, 2025

@xushichangdesmond what you seem to refer to is the upstream health check in the load balancer module:

if let Some(read_timeout) = peer.options.read_timeout {
session.set_read_timeout(read_timeout);
}

It's a different health check than the one I'm referring to: I want to serve HTTP until the very last second of the process (including during the graceful shutdown period), but that doesn't seem possible as the service listener stops, so no more (TCP) connections are allowed – does that make sense?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants