summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-11-23 14:58:16 +0100
committerGitHub <noreply@github.com>2021-11-23 14:58:16 +0100
commit9e07cb17a92dd24df8053193e1e047f211a72a54 (patch)
treea73c7a959523ba04d4b5452b255ead4422374045
parent3a19cdcc77bf2fd635d19bae6bdccc3d531a56c2 (diff)
parenta4e4b8d9269761efd97848b4c88f092f9cfd497b (diff)
downloadpodman-9e07cb17a92dd24df8053193e1e047f211a72a54.tar.gz
podman-9e07cb17a92dd24df8053193e1e047f211a72a54.tar.bz2
podman-9e07cb17a92dd24df8053193e1e047f211a72a54.zip
Merge pull request #12394 from flouthoc/oci_dont_send_signal_to_dead
oci: exit `gracefully` if container is already dead instead of trying to `kill` it.
-rw-r--r--libpod/oci_conmon_linux.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go
index bcf45ec8d..ea6facfa6 100644
--- a/libpod/oci_conmon_linux.go
+++ b/libpod/oci_conmon_linux.go
@@ -297,7 +297,7 @@ func (r *ConmonOCIRuntime) UpdateContainerStatus(ctr *Container) error {
if err2 != nil {
return errors.Wrapf(err, "error getting container %s state", ctr.ID())
}
- if strings.Contains(string(out), "does not exist") {
+ if strings.Contains(string(out), "does not exist") || strings.Contains(string(out), "No such file") {
if err := ctr.removeConmonFiles(); err != nil {
logrus.Debugf("unable to remove conmon files for container %s", ctr.ID())
}
@@ -407,6 +407,11 @@ func (r *ConmonOCIRuntime) KillContainer(ctr *Container, signal uint, all bool)
args = append(args, "kill", ctr.ID(), fmt.Sprintf("%d", signal))
}
if err := utils.ExecCmdWithStdStreams(os.Stdin, os.Stdout, os.Stderr, env, r.path, args...); err != nil {
+ // try updating container state but ignore errors we cant do anything if this fails.
+ r.UpdateContainerStatus(ctr)
+ if ctr.state.State == define.ContainerStateExited {
+ return nil
+ }
return errors.Wrapf(err, "error sending signal to container %s", ctr.ID())
}