mirror of
https://github.com/containers/podman.git
synced 2025-07-04 18:27:33 +08:00
libpod: race in WaitForConditionWithInterval()
There are multiple concurrent goroutinces which produce result and they race agains each other, while producing different results. This commit addresses at least a part of the problem - producing different results for competing "sources". Fixes: #25479 Signed-off-by: Yuri Timenkov <yuri@timenkov.pro>
This commit is contained in:
@ -771,6 +771,12 @@ func (c *Container) WaitForConditionWithInterval(ctx context.Context, waitTimeou
|
||||
// This allows callers to actually wait for the ctr to be removed.
|
||||
if wantedStates[define.ContainerStateRemoving] &&
|
||||
(errors.Is(err, define.ErrNoSuchCtr) || errors.Is(err, define.ErrCtrRemoved)) {
|
||||
// check if the exit code was recorded in the db to return it
|
||||
exitCode, err := c.runtime.state.GetContainerExitCode(c.ID())
|
||||
if err == nil {
|
||||
trySend(exitCode, nil)
|
||||
}
|
||||
|
||||
trySend(-1, nil)
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user