From 7610cedc80bfd3e9dd11f14da4f810e568f8df36 Mon Sep 17 00:00:00 2001 From: Paul Holzinger Date: Wed, 31 Jul 2024 19:00:16 +0200 Subject: [PATCH] libpod: inhibit SIGTERM during cleanup() The network cleanup can handle it when it is killed half way through as it spits out a bunch of error in that case on the next cleanup attempt. Try to avoid getting into such a state and ignore sigterm during this section. Of course we stil can get SIGKILL so we should work on fixing the underlying problems in network cleanup but let's see if this helps us with the CI flakes in the meantime. Signed-off-by: Paul Holzinger --- libpod/container_internal.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libpod/container_internal.go b/libpod/container_internal.go index 46cd413459..0fd80250a5 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -2046,6 +2046,11 @@ func (c *Container) cleanup(ctx context.Context) error { logrus.Debugf("Cleaning up container %s", c.ID()) + // Ensure we are not killed half way through cleanup + // which can leave us in a bad state. + shutdown.Inhibit() + defer shutdown.Uninhibit() + // Remove healthcheck unit/timer file if it execs if c.config.HealthCheckConfig != nil { if err := c.removeTransientFiles(ctx,