-
Notifications
You must be signed in to change notification settings - Fork 18.6k
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
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
Non-fatal signals break restart policies #11065
Comments
/cc @crosbymichael |
Yep, this looks like a bug, thanks for the ping. |
@crosbymichael Any ideas how to fix it? Seems more like a logic issue than a code bug. |
logic but it's kinda hard to identify what is a "non-fatal" signal compared to something else. Like what happens if a non-fatal signal actually crashes the app? |
Yes, for anything other than |
What about things like SIGINT? I usually consider it a terminating signal in most apps |
@crosbymichael Yes, thats the default. But application can choose to ignore it or do something else. |
I think this is where it happens: container.KillSig calls monitor.ExitOnNext() |
But it is more a "decide what the behavior should be" kinda bug than a "definitely wrong" bug. |
In response to #12727, I'm proposing the following syntax:
If the signal is one of If If Problem with the current solution is that although it provides defaults that work most of the time it leaves edge-cases that are impossible to handle correctly. #12727 provides better defaults but still leaves cases that can't be handled. Not only the problem I brought up in the comments there - also for example when my container uses a custom signal to do a clean shutdown, I wouldn't be able to shut down a container with any signal except the ones that are whitelisted. This solution still maintains good defaults and adds a way to handle all the edge-cases(I hope). Of course, as a counter-argument, the logic is quite complicated to grasp. |
@tonistiigi +1 I'm not super knowledgeable about the project, but it certainly seems like one might want to be able to determine whether or not a container had stopped on the basis of |
Can we get this moved back to 1.7.x? |
We now have stopsignal support, we can probably look at this to determine if the restart policy should be disabled. |
I am still seeing this issue in Docker CE 19.0.3:
I would expect the container to be running after restarting docker. |
Due to a Docker bug [1] we cannot use Docker to send SIGHUP to the container because it will mark it as stopped. This patch sends the signal directly to the process, bypassing Docker. 'changed_when: false' is also removed from the relevant task as it definitely changes the state. In the future we could do the refresh only if there really is a need for another one. [1] moby/moby#11065 Change-Id: Ief73bbd24568d6941384ea3330ab45f11aa42d37 Co-authored-by: Radosław Piliszek <radoslaw.piliszek@gmail.com> Closes-Bug: #1845244
* Update kolla-ansible from branch 'master' - Merge "Fix nova scheduler down after first docker restart" - Fix nova scheduler down after first docker restart Due to a Docker bug [1] we cannot use Docker to send SIGHUP to the container because it will mark it as stopped. This patch sends the signal directly to the process, bypassing Docker. 'changed_when: false' is also removed from the relevant task as it definitely changes the state. In the future we could do the refresh only if there really is a need for another one. [1] moby/moby#11065 Change-Id: Ief73bbd24568d6941384ea3330ab45f11aa42d37 Co-authored-by: Radosław Piliszek <radoslaw.piliszek@gmail.com> Closes-Bug: #1845244
Due to a Docker bug [1] we cannot use Docker to send SIGHUP to the container because it will mark it as stopped. This patch sends the signal directly to the process, bypassing Docker. 'changed_when: false' is also removed from the relevant task as it definitely changes the state. In the future we could do the refresh only if there really is a need for another one. [1] moby/moby#11065 Change-Id: Ief73bbd24568d6941384ea3330ab45f11aa42d37 Co-authored-by: Radosław Piliszek <radoslaw.piliszek@gmail.com> Closes-Bug: #1845244 (cherry picked from commit 6bdf202) (cherry picked from commit 2242fce)
Due to a Docker bug [1] we cannot use Docker to send SIGHUP to the container because it will mark it as stopped. This patch sends the signal directly to the process, bypassing Docker. 'changed_when: false' is also removed from the relevant task as it definitely changes the state. In the future we could do the refresh only if there really is a need for another one. [1] moby/moby#11065 Change-Id: Ief73bbd24568d6941384ea3330ab45f11aa42d37 Co-authored-by: Radosław Piliszek <radoslaw.piliszek@gmail.com> Closes-Bug: #1845244 (cherry picked from commit 6bdf202)
Sending a signal with
docker kill
that is handled by the application will turn off restart policies for that container.Not sure how to fix this without changing the behavior for
docker kill
as there is no way to predict if a signal will cause the container to exit or not.To me its kind of weird that
docker kill -s TERM foo
andkill -SIGTERM $(docker inspect -f "{{.State.Pid}}" foo)
have different meaning for the restart logic, but I can see it being useful for some situations.Tested with
v1.5.0
andmaster
The text was updated successfully, but these errors were encountered: