From 178125ae39758bfcdbed6a60d1671b8755d9aadb Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 14 Aug 2023 12:36:57 +0200 Subject: [PATCH] libcontainerd/supervisor: explicitly ignore process kill errors Signed-off-by: Sebastiaan van Stijn --- libcontainerd/supervisor/remote_daemon.go | 5 ++--- libcontainerd/supervisor/remote_daemon_linux.go | 4 ++-- libcontainerd/supervisor/remote_daemon_windows.go | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/libcontainerd/supervisor/remote_daemon.go b/libcontainerd/supervisor/remote_daemon.go index 98a8a3cb73..cc245a8a99 100644 --- a/libcontainerd/supervisor/remote_daemon.go +++ b/libcontainerd/supervisor/remote_daemon.go @@ -209,9 +209,8 @@ func (r *remote) startContainerd() error { r.logger.WithError(err).Warn("failed to adjust OOM score") } - err = pidfile.Write(r.pidFile, r.daemonPid) - if err != nil { - process.Kill(r.daemonPid) + if err := pidfile.Write(r.pidFile, r.daemonPid); err != nil { + _ = process.Kill(r.daemonPid) return errors.Wrap(err, "libcontainerd: failed to save daemon pid to disk") } diff --git a/libcontainerd/supervisor/remote_daemon_linux.go b/libcontainerd/supervisor/remote_daemon_linux.go index 626f66d3c6..095aa3c930 100644 --- a/libcontainerd/supervisor/remote_daemon_linux.go +++ b/libcontainerd/supervisor/remote_daemon_linux.go @@ -49,9 +49,9 @@ func (r *remote) stopDaemon() { func (r *remote) killDaemon() { // Try to get a stack trace - syscall.Kill(r.daemonPid, syscall.SIGUSR1) + _ = syscall.Kill(r.daemonPid, syscall.SIGUSR1) <-time.After(100 * time.Millisecond) - process.Kill(r.daemonPid) + _ = process.Kill(r.daemonPid) } func (r *remote) platformCleanup() { diff --git a/libcontainerd/supervisor/remote_daemon_windows.go b/libcontainerd/supervisor/remote_daemon_windows.go index 9cb4610509..6c3d3e8aec 100644 --- a/libcontainerd/supervisor/remote_daemon_windows.go +++ b/libcontainerd/supervisor/remote_daemon_windows.go @@ -40,7 +40,7 @@ func (r *remote) stopDaemon() { } func (r *remote) killDaemon() { - process.Kill(r.daemonPid) + _ = process.Kill(r.daemonPid) } func (r *remote) platformCleanup() {