mirror of
https://github.com/containers/podman.git
synced 2026-07-25 22:47:15 -04:00
There is a race condition in the signal handling which manifests itself as flake in our CI. In short the old code was running the signal handler in a goroutine but never waited for it to be finished the main routine just waits for the container exit so it was possible the process exits in PlayKubeDown() between the PodStop and PodRm calls. So the container/pod was leaked and thus the test fails. This can be easily reproduced by adding a sleep there. To fix this properly we use a wait group to ensure the goroutine is finished before we exit. Then there is also no need for the extra bool and teardown on the non signal path. We can just close the channel there and cleanup via the signal goroutine which will always fire when the channel is closed. Signed-off-by: Paul Holzinger <pholzing@redhat.com>