From 67e300d4d90452abcc9f7be7921f0f7fcdb85248 Mon Sep 17 00:00:00 2001 From: Valentin Rothberg Date: Sun, 28 Aug 2022 19:19:01 +0200 Subject: [PATCH] libpod: UpdateContainerStatus: do not wait for container Commit 30e7cbccc194 accidentally added a deadlock as Podman was waiting for the exit code to show up when the container transitioned to stopped. Code paths that require the exit code to be written (by the cleanup process) should already be using `(*Container).Wait()` in a deadlock free way. [NO NEW TESTS NEEDED] as I did not manage to a reproducer that would work in CI. Ultimately, it's a race condition. Backport-for: #15492 BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2124716 BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2125647 Signed-off-by: Valentin Rothberg --- libpod/oci_conmon_linux.go | 9 --------- 1 file changed, 9 deletions(-) diff --git a/libpod/oci_conmon_linux.go b/libpod/oci_conmon_linux.go index cb76de72c2..c8378e1242 100644 --- a/libpod/oci_conmon_linux.go +++ b/libpod/oci_conmon_linux.go @@ -337,15 +337,6 @@ func (r *ConmonOCIRuntime) UpdateContainerStatus(ctr *Container) error { ctr.ID(), state.Status, define.ErrInternal) } - // Only grab exit status if we were not already stopped - // If we were, it should already be in the database - if ctr.state.State == define.ContainerStateStopped && oldState != define.ContainerStateStopped { - if _, err := ctr.Wait(context.Background()); err != nil { - logrus.Errorf("Waiting for container %s to exit: %v", ctr.ID(), err) - } - return nil - } - // Handle ContainerStateStopping - keep it unless the container // transitioned to no longer running. if oldState == define.ContainerStateStopping && (ctr.state.State == define.ContainerStatePaused || ctr.state.State == define.ContainerStateRunning) {