Skip to content

Commit fe1b4cf

Browse files
committed
Set unpasued state when receiving 'stateExit' event
Description: 1. start a container with restart=always. `docker run -d --restart=always ubuntu sleep 3` 2. container init process exits. 3. use `docker pause <id>` to pause this container. if the pause action is before cgroup data is removed and after the init process died. `Pause` operation will success to write cgroup data, but actually do not freeze any process. And then docker received pause event and stateExit event from containerd, the docker state will be Running(paused), but the container is free running. Then we can not remove it, stop it , pause it and unpause it. Signed-off-by: Wentao Zhang <zhangwentao234@huawei.com>
1 parent 7117d5e commit fe1b4cf

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

container/state.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ func (s *State) SetRunning(pid int, initial bool) {
278278
s.ErrorMsg = ""
279279
s.Running = true
280280
s.Restarting = false
281+
s.Paused = false
281282
s.ExitCodeValue = 0
282283
s.Pid = pid
283284
if initial {
@@ -304,6 +305,7 @@ func (s *State) SetRestarting(exitStatus *ExitStatus) {
304305
// all the checks in docker around rm/stop/etc
305306
s.Running = true
306307
s.Restarting = true
308+
s.Paused = false
307309
s.Pid = 0
308310
s.FinishedAt = time.Now().UTC()
309311
s.setFromExitStatus(exitStatus)

0 commit comments

Comments
 (0)