diff options
author | Matthew Heon <mheon@redhat.com> | 2021-11-23 09:21:05 -0500 |
---|---|---|
committer | Matthew Heon <mheon@redhat.com> | 2021-11-23 09:50:12 -0500 |
commit | 5cf2683bfef7f15aaccc6f2321fb1e63dbf3f18a (patch) | |
tree | 5034655049fd863a9e458e105e0b88916506d3e7 | |
parent | 9e07cb17a92dd24df8053193e1e047f211a72a54 (diff) | |
download | podman-5cf2683bfef7f15aaccc6f2321fb1e63dbf3f18a.tar.gz podman-5cf2683bfef7f15aaccc6f2321fb1e63dbf3f18a.tar.bz2 podman-5cf2683bfef7f15aaccc6f2321fb1e63dbf3f18a.zip |
Warn on failing to update container status
failed to send a signal to the container's PID1, but ignored the
results of that update. That's generally bad practice, since even
if we can't directly take action on an error, we should still
make an effort to report it for debugging purposes. I used Infof
instead of something more serious to avoid duplicate reporting to
the user if something has gone seriously wrong.
[NO NEW TESTS NEEDED] this is just adding additional error reporting.
Signed-off-by: Matthew Heon <mheon@redhat.com>
-rw-r--r-- | libpod/oci_conmon_linux.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go index ea6facfa6..baf05189c 100644 --- a/libpod/oci_conmon_linux.go +++ b/libpod/oci_conmon_linux.go @@ -407,8 +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) + // Update container state - there's a chance we failed because + // the container exited in the meantime. + if err2 := r.UpdateContainerStatus(ctr); err2 != nil { + logrus.Infof("Error updating status for container %s: %v", ctr.ID(), err2) + } if ctr.state.State == define.ContainerStateExited { return nil } |