Skip to content

Commit

Permalink
libpod: UpdateContainerStatus: do not wait for container
Browse files Browse the repository at this point in the history
Commit 30e7cbc 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.

Fixes: containers#15492
Signed-off-by: Valentin Rothberg <[email protected]>
  • Loading branch information
vrothberg committed Aug 26, 2022
1 parent 36cf6f5 commit 15aeccb
Showing 1 changed file with 0 additions and 9 deletions.
9 changes: 0 additions & 9 deletions libpod/oci_conmon_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,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) {
Expand Down

0 comments on commit 15aeccb

Please sign in to comment.