-
Notifications
You must be signed in to change notification settings - Fork 48
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
docker seems to kill the container instead of terminating it #68
Comments
Thanks for the report. I've confirmed this to be the case but I have no idea what to do about it. |
I believe the problem is the way the entrypoint script is written. Docker sends the SIGTERM to PID 1 in the container, which must be able to handle this signal. When a shell script starts another process, it must make sure to propagate this signal. The fact that after 10s SIGKILL is issues is a hint that the signal either didn't get to the prosody process or wasn't processed there. See also https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#entrypoint |
|
Confirmed with the following small test script:
Sending SIGTERM to the pid printed by the script, does not terminated the |
tini [1] is a minimalistic PID 1 process. It correctly handles the special jobs which PID 1 (or a reaper process in general) needs to take care of in addition to correctly processing the relevant signals. Fixes prosody#68. [1]: https://github.com/krallin/tini
tini [1] is a minimalistic PID 1 process. It correctly handles the special jobs which PID 1 (or a reaper process in general) needs to take care of in addition to correctly processing the relevant signals. Fixes #68. [1]: https://github.com/krallin/tini
The problem reported here, was indeed fixed, but already with cc88073 and #65. As you can see in the process list in the top post, there's still entrypoint.sh as PID 1. The only logical conclusion ist, the image prosody/prosody:0.11 on which my image is based on, is not build with the recent master of prosody-docker, but with some old state before cc88073. I could prove that by modifying (and copying) I'm not happy with the graceful shutdown yet, but that would be off topic here, since the actual problem reported was invalid in the first place. |
This reverts commit 31d6d84. While tini successfully forwards signals, this leads to `runuser` killing prosody now. The container does terminate in 10 seconds, so Docker is happy and you could argue that actually fixes prosody#68, but it's no graceful shutdown. The revert is done because it's easier to apply a real fix without tini.
This reverts commit 31d6d84. While tini successfully forwards signals, this leads to `runuser` killing prosody now. The container does terminate in 10 seconds, so Docker is happy and you could argue that actually fixes #68, but it's no graceful shutdown. The revert is done because it's easier to apply a real fix without tini.
Although #65 claims to have fixed signal handling, it does not work for me. I start the container with a little script like this:
If prosody is shut down gracefully with SIGTERM log output should be like this:
When calling
docker stop
however it takes the usual 10 seconds and then prosody only gets SIGKILL and there's no log output anymore:The process list:
The text was updated successfully, but these errors were encountered: