From 8433a01aa2687febb934eaa40393e144273c01ba Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Thu, 9 May 2024 21:21:36 +0200 Subject: [PATCH] Revert "container stop: kill conmon" This reverts commit 909ab594191ce964529398bcf7600edff9540d71. The workaround was added almost 5 years ago to workaround an issue with old conmon releases. It is safe to assume such ancient conmon releases are not used anymore. Signed-off-by: Giuseppe Scrivano --- libpod/container_internal.go | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/libpod/container_internal.go b/libpod/container_internal.go index bcbf13f6d2..004f8a5578 100644 --- a/libpod/container_internal.go +++ b/libpod/container_internal.go @@ -1512,7 +1512,6 @@ func (c *Container) restartWithTimeout(ctx context.Context, timeout uint) (retEr c.newContainerEvent(events.Restart) if c.state.State == define.ContainerStateRunning { - conmonPID := c.state.ConmonPID if err := c.stop(timeout); err != nil { return err } @@ -1522,23 +1521,6 @@ func (c *Container) restartWithTimeout(ctx context.Context, timeout uint) (retEr logrus.Error(err.Error()) } } - // Old versions of conmon have a bug where they create the exit file before - // closing open file descriptors causing a race condition when restarting - // containers with open ports since we cannot bind the ports as they're not - // yet closed by conmon. - // - // Killing the old conmon PID is ~okay since it forces the FDs of old conmons - // to be closed, while it's a NOP for newer versions which should have - // exited already. - if conmonPID != 0 { - // Ignore errors from FindProcess() as conmon could already have exited. - p, err := os.FindProcess(conmonPID) - if p != nil && err == nil { - if err = p.Kill(); err != nil { - logrus.Debugf("error killing conmon process: %v", err) - } - } - } // Ensure we tear down the container network so it will be // recreated - otherwise, behavior of restart differs from stop // and start