-
Notifications
You must be signed in to change notification settings - Fork 567
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 stop's SIGTERM is ignored so has to wait to SIGKILL to stop #386
Comments
as an addendum, if I docker exec into the container, |
Can you give a little more detail about how you're running your container? I can't reproduce a failure. In one terminal, I ran If this is related to your example in #387, then I'd suggest changing |
They aren't quite related (i.e. I see the behavior without it), but I ran into them at same time, but was able to isolate
and
notice how it doesn't print anything about getting signal and shutting down. I'm wondering if its my docker (ubuntu provided one)
For my current use case, I've replaced docker stop {id} with docker exec {id} /bin/bash -c "kill -SIGTERM 1" (kill doesn't seem to be in container as a separate command), which accomplishes what I need, but I'm confused, I dont see anything that would cause that. if I do what I said above, it behaves as I'd expect and exits gracefully
|
@sjpotter can you confirm that the redis process is PID1 when it doesn't get the SIGTERM? |
then ls -l /proc/
and again
so it seems there's only one process as pid1 as each bash got the only other pid.
|
The biggest difference between your reproducer and mine is the use of $ docker run -d --name redis redis
Unable to find image 'redis:latest' locally
latest: Pulling from library/redis
1f7ce2fa46ab: Already exists
4827e9d1e197: Pull complete
5845062cfda9: Pull complete
44d659adcf8b: Pull complete
b6962d83313d: Pull complete
5d29cf86ecab: Pull complete
4f4fb700ef54: Pull complete
3a2d9f90268c: Pull complete
Digest: sha256:396b0f027ba2f33bf385771a621b58c1fd834fd2c522c35c98fd24fc17863c2f
Status: Downloaded newer image for redis:latest
abddc0c0d336cab9b736bdcc7447596d273c1f201499fc1cee91fbc0ba00f1b1
$ time docker stop redis
redis
real 0m0.343s
user 0m0.010s
sys 0m0.010s
$ docker logs redis --tail=6
1:M 13 Dec 2023 19:32:27.356 * Ready to accept connections tcp
1:signal-handler (1702495952) Received SIGTERM scheduling shutdown...
1:M 13 Dec 2023 19:32:32.474 * User requested shutdown...
1:M 13 Dec 2023 19:32:32.474 * Saving the final RDB snapshot before exiting.
1:M 13 Dec 2023 19:32:32.482 * DB saved on disk
1:M 13 Dec 2023 19:32:32.482 # Redis is now ready to exit, bye bye... |
perhaps a problem with ubuntu's provided docker. I should test with upstream directly, but hard to do that right now without possibly breaking my ability to work. |
With normal redis outsides a container, I can send it a SIGINT or a SIGTERM and it catches it and stops cleanly basically immeadiately. When run with this docker container, I'd then expect similar behavior if I did a docker stop (or a docker rm -f). However, that is not what I see. It delays 10 seconds or so until it just seems to get the SIGKILL.
in watching the docker container (docker run -it) in one window and then I do a docker stop in another window, I see nothing happen in the redis output until it just dies without any messages (i.e. indicating to me that it was SIGKILLed).
The text was updated successfully, but these errors were encountered: