Fix restart docker daemon with paused containers#13304
Conversation
|
I dont think you can SIGTERM a paused container? but someone correct me if I am wrong |
|
Correct, it won't do anything since it's been frozen and as such can't respond to signals. |
|
@cpuguy83 is right, if you want SIGKILL or SIGTERM to a frozen process, you should send |
|
can we have an integration test to prove that is true. |
|
@jfrazelle Had add a integration test |
|
@coolljt0725 GitHub says it needs a rebase. |
|
@thaJeztah yeah, thanks |
e3d25b1 to
74aee6e
Compare
|
since #12400 is merged, if the design of this is ok, I'll rebase this. ping @cpuguy83 @LK4D4 @jfrazelle @calavera @thaJeztah |
|
Hi all, if the design is ok, I'll rebase this |
|
Also, @coolljt0725 does this solve #12797? |
|
design looks ok for me |
|
Should we try to fix this upon daemon startup instead? What if the daemon crashes w/o daemon.Shutdown() func having a chance to be called. I'm assuming we'll run into the original issue, right? |
|
@duglin I think fix this on docker daemon shutdown is also to do some cleanup of containers to avoid orphaned virt interfaces and unmounted rootfs... |
74aee6e to
86b39c6
Compare
|
rebased , ping @LK4D4 @cpuguy83 @jfrazelle @duglin @calavera |
|
@coolljt0725 yes but my point is that I don't think we can count on that code always being run. What if someone just pulls the plug on the machine and it dies? Don't we need to do this logic upon daemon startup otherwise things will still be in a bad state? |
|
@duglin I understand you point , I think this is a common problem not only for docker, other software have the same problem, abnormal shutdown of software will with some information missing and hard to recover or cleanup on next startup. |
|
@coolljt0725 I haven't had a chance to look into why its hanging, has the investigation been done? Do we know what the fix is to if this cleanup func isn't run? In other words, what can the user do to get out of this bad state? |
|
@duglin I have investigated this. The hang will only happened when use |
|
@coolljt0725 is there any way to kill the frozen process? (w/o actually rebooting the machine) |
|
@duglin Sorry for the delay. I think the way to kill the frozen process is to send a |
|
@coolljt0725 is this something we can do for those processes during daemon startup to avoid a hang? |
|
Ping @coolljt0725 |
|
@tiborvass I don't understand your comment above. Do you mean we should add a empty SignalMap in signal_windows.go? |
|
ping @tiborvass |
|
so sorry needs a rebase |
ec485a7 to
387310d
Compare
|
@jfrazelle @tiborvass rebased |
|
so so sorry needs another rebase |
387310d to
abd03d5
Compare
|
@jfrazelle @tiborvass rebased |
There was a problem hiding this comment.
We probably need to handle this case now being that Windows + Docker is a thing now,
abd03d5 to
9a9724a
Compare
|
@jfrazelle @cpuguy83 rebased |
Signed-off-by: Lei Jitang <[email protected]>
|
code LGTM |
|
LGTM, tested locally. We should probably open a separate issue to discuss handling of paused containers when someone calls |
…_containers Fix restart docker daemon with paused containers
Signed-off-by: Lei Jitang [email protected]
I think this is better fix than #12802 .
Restarting docker daemon with paused containers really caused a big problem,
the paused containers will can't be start on docker daemon restart, and if the
paused containers happened to have a restart policy
restart=always, the daemon will hang.So, I think we should prevent these from happening.
This fix is to send 15 to container and then unpause it, this is just what
the kernel designed for. If we want terminate a process in freezer cgroup,
we should send terminate signal to this process and then unfreeze it, and then this process will
terminate. In this way, it will not case unsafe problem.
ping @LK4D4 @aluzzardi @tiborvass @jfrazelle @cpuguy83
cc @lexandro
But if we just want to keep it work like it does today, pls feel free to close :)