Skip to content

Commit

Permalink
Merge pull request containers#18869 from vrothberg/debug-18860
Browse files Browse the repository at this point in the history
container wait: indicate timeout in error
  • Loading branch information
openshift-merge-robot authored Jun 13, 2023
2 parents 17d1910 + c0ab293 commit 2a947c2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libpod/container_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -610,12 +610,14 @@ func (c *Container) WaitForExit(ctx context.Context, pollInterval time.Duration)
}
}

timedout := ""
if !containerRemoved {
// If conmon is dead for more than $timerDuration or if the
// container has exited properly, try to look up the exit code.
select {
case <-conmonTimer.C:
logrus.Debugf("Exceeded conmon timeout waiting for container %s to exit", id)
timedout = " [exceeded conmon timeout waiting for container to exit]"
default:
switch c.state.State {
case define.ContainerStateExited, define.ContainerStateConfigured:
Expand All @@ -642,7 +644,7 @@ func (c *Container) WaitForExit(ctx context.Context, pollInterval time.Duration)
return true, 0, nil
}
}
return true, -1, fmt.Errorf("%w (container in state %s)", err, c.state.State)
return true, -1, fmt.Errorf("%w (container in state %s)%s", err, c.state.State, timedout)
}

return true, exitCode, nil
Expand Down

0 comments on commit 2a947c2

Please sign in to comment.