Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #181 from thaJeztah/18.09_backport_fix_stopped_res…
Browse files Browse the repository at this point in the history
…tart_containers

[18.09 backport] Fix stopped containers with restart-policy showing as "restarting"
  • Loading branch information
andrewhsu authored Mar 28, 2019
2 parents 200b524 + 00f0b9d commit 160b62e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions daemon/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerd.EventType, ei libc
}
daemon.LogContainerEventWithAttributes(c, "die", attributes)
daemon.Cleanup(c)
daemon.setStateCounter(c)
cpErr := c.CheckpointTo(daemon.containersReplica)

if err == nil && restart {
go func() {
Expand All @@ -101,6 +103,8 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerd.EventType, ei libc
if err != nil {
c.Lock()
c.SetStopped(&exitStatus)
daemon.setStateCounter(c)
c.CheckpointTo(daemon.containersReplica)
c.Unlock()
defer daemon.autoRemove(c)
if err != restartmanager.ErrRestartCanceled {
Expand All @@ -110,8 +114,7 @@ func (daemon *Daemon) ProcessEvent(id string, e libcontainerd.EventType, ei libc
}()
}

daemon.setStateCounter(c)
return c.CheckpointTo(daemon.containersReplica)
return cpErr
}

if execConfig := c.ExecCommands.Get(ei.ProcessID); execConfig != nil {
Expand Down

0 comments on commit 160b62e

Please sign in to comment.