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

Kibana docker image does not respond to SIGTERM #113374

Closed
lchdev opened this issue Sep 29, 2021 · 5 comments
Closed

Kibana docker image does not respond to SIGTERM #113374

lchdev opened this issue Sep 29, 2021 · 5 comments
Labels
bug Fixes for quality problems that affect the customer experience Team:Operations Team label for Operations Team

Comments

@lchdev
Copy link

lchdev commented Sep 29, 2021

Kibana version:

Tested with latest 7.15.0 and 8.0.0-alpha2

Original install method (e.g. download page, yum, from source, etc.):

Using the official docker.elastic.co/kibana/kibana image

Describe the bug:

The container does not respond to SIGTERM, making it impossible to gracefully shutdown Kibana.

Steps to reproduce:

  1. Execute docker run --rm docker.elastic.co/kibana/kibana:7.15.0
  2. Try to press CTRL+C
  3. Nothing happens

Expected behavior:

The container should respond to the TERM signal and gracefully shutdown

Identified cause:

There are three running processes in the conainer:

bash-4.4$ ps -e --forest
  PID TTY          TIME CMD
    1 ?        00:00:00 tini
    7 ?        00:00:00 node
  952 ?        00:01:04  \_ node

The main "node" process (PID 7) does not respond to SIGTERM (I am not a node specialist, I can't really explain why), only the child node process (952) does. When a SIGTERM is sent to the container, PID1 (tini) forwards it to the main node process (PID 7) only, and nothing happens.

This is different from when Kibana is run with systemd, because by default systemd will send a SIGTERM signal to ALL the processes of the cgroup, causing Kibana to stop gracefully.

As a workaround, I am currently using dumb-init in place of tini, because it behaves like systemd in this regards (sends signals to all spawn processes).

Example Dockerfile:

FROM docker.elastic.co/kibana/kibana:7.15.0

USER root
ADD https://github.com/Yelp/dumb-init/releases/download/v1.2.5/dumb-init_1.2.5_x86_64 /usr/local/bin/dumb-init
RUN chmod +x /usr/local/bin/dumb-init

USER kibana
ENTRYPOINT ["/usr/local/bin/dumb-init", "--"]
CMD ["/usr/local/bin/kibana-docker"]
@lchdev lchdev added the bug Fixes for quality problems that affect the customer experience label Sep 29, 2021
@botelastic botelastic bot added the needs-team Issues missing a team label label Sep 29, 2021
@lchdev
Copy link
Author

lchdev commented Sep 30, 2021

Actually, I had missed it, this this can be achieved by tini using the -g flag:

FROM docker.elastic.co/kibana/kibana:7.15.0
ENTRYPOINT ["tini", "-g", "--"]
CMD ["/usr/local/bin/kibana-docker"]

@nickpeihl nickpeihl added the Team:Operations Team label for Operations Team label Dec 8, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-operations (Team:Operations)

@botelastic botelastic bot removed the needs-team Issues missing a team label label Dec 8, 2021
@jbudz
Copy link
Member

jbudz commented Dec 9, 2021

This should be fixed with #114940 targeting 7.15.2+. I verified locally that Ctrl+C worked. Can you give that version a try?

@lchdev
Copy link
Author

lchdev commented Dec 9, 2021

I confirm this is now working properly in version 7.15.2. Thanks !

@jbudz
Copy link
Member

jbudz commented Dec 9, 2021

Great - closing this out. Thanks for confirming!

@jbudz jbudz closed this as completed Dec 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience Team:Operations Team label for Operations Team
Projects
None yet
Development

No branches or pull requests

4 participants