diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-06-09 10:09:14 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-09 10:09:14 +0200 |
commit | 79f30af384cf6c74f89c3b44c01707da22d867e5 (patch) | |
tree | 23743436c054a1de091ae7d0ecb008d066786360 /libpod/container_internal.go | |
parent | a85e97952994a2803a17ee2a384b260115f18b43 (diff) | |
parent | 9d964ffb9fc98ed13f6fec974c917b84c175d39a (diff) | |
download | podman-79f30af384cf6c74f89c3b44c01707da22d867e5.tar.gz podman-79f30af384cf6c74f89c3b44c01707da22d867e5.tar.bz2 podman-79f30af384cf6c74f89c3b44c01707da22d867e5.zip |
Merge pull request #6520 from mheon/no_conmon_no_error
Ensure Conmon is alive before waiting for exit file
Diffstat (limited to 'libpod/container_internal.go')
-rw-r--r-- | libpod/container_internal.go | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 43e873bd6..f6fc3c1a4 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -1209,13 +1209,35 @@ func (c *Container) stop(timeout uint) error { } } + // Check if conmon is still alive. + // If it is not, we won't be getting an exit file. + conmonAlive, err := c.ociRuntime.CheckConmonRunning(c) + if err != nil { + return err + } + if err := c.ociRuntime.StopContainer(c, timeout, all); err != nil { return err } + c.newContainerEvent(events.Stop) + c.state.PID = 0 c.state.ConmonPID = 0 c.state.StoppedByUser = true + + if !conmonAlive { + // Conmon is dead, so we can't epect an exit code. + c.state.ExitCode = -1 + c.state.FinishedTime = time.Now() + c.state.State = define.ContainerStateStopped + if err := c.save(); err != nil { + logrus.Errorf("Error saving container %s status: %v", c.ID(), err) + } + + return errors.Wrapf(define.ErrConmonDead, "container %s conmon process missing, cannot retrieve exit code", c.ID()) + } + if err := c.save(); err != nil { return errors.Wrapf(err, "error saving container %s state after stopping", c.ID()) } @@ -1225,8 +1247,6 @@ func (c *Container) stop(timeout uint) error { return err } - c.newContainerEvent(events.Stop) - return nil } |