-
Notifications
You must be signed in to change notification settings - Fork 8.1k
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
SIGTERM should gracefully shutdown Kibana #84452
Comments
Pinging @elastic/kibana-core (Team:Core) |
From https://github.com/igorgolovanov/hapi-graceful-shutdown/blob/master/lib/index.js, it seems it can easily be performed by providing a However if we need to support the Point 5, |
I think i. and ii. can be easily implemented with a middleware that is a simple pass-through (calls I also think the header |
I guess this is not strictly necessary. A graceful shutdown should be a fairly short period of time so user's don't really need to query the status api to see what's happening and the load balancer will anyway remove the node so in most deployments it won't even be possible to reach the endpoint. Just checked, hapi's server.stop will close any keep-alive sockets https://github.com/hapijs/hapi/blob/master/lib/core.js#L449-L456 |
That would greatly facilitate the implementation, as we could just let HAPI handle it entirely then. |
I've been testing it locally and I've got some relieving data:
The observed behaviour:
There are some gotchas though:
I'll create a PR:
Regarding the default timeout value, there is not a common agreed value in different architectures:
What do you think? |
maybe up to 30sec, there might be some long-running requests to ES?
good to start.
Is it in the dev mode only? |
Happy to use that default. Are we OK with docker killing the process earlier by default?
Nope, running |
Reopening to run the necessary follow-ups:
|
|
To avoid data loss when Kibana is stopped (either to restart a process or upgrade Kibana), we should support a graceful shutdown which stops receiving new work and tries to complete all in-progress work before the process is terminated:
SIGTERM
signal it starts a graceful shutdown and performs the following steps:503
from it's healthcheck endpoint to signal to the load balancer that it's no longer accepting new traffic (requires Create health check / readiness endpoint #46984)./api/status
and the healthcheck endpoints?). This provides a strong guarantee that Kibana won't accept any new work/long running connections. As a first step we could rely on users correctly configuring their load-balancer to no longer send any traffic, but this feels error prone and doesn't help users who don't run Kibana behind a load balancer.await hapiServer.stop({ timeout: 30 * 1000 });
connection: close
header. (edit: already taken care of by hapi's server.stop() https://github.com/hapijs/hapi/blob/master/lib/core.js#L449-L456)From https://github.com/rudolf/kibana/blob/8f10cf22a93bd87a316a13a7965d4f5c8f160738/rfcs/text/0013_saved_object_migrations.md#4213-upgrade-and-rollback-procedure
The text was updated successfully, but these errors were encountered: