From 63926c6e0d8a44c39aab1ced7ca72982083c6493 Mon Sep 17 00:00:00 2001 From: Richard Mortimer Date: Tue, 18 Mar 2025 10:29:00 +0000 Subject: [PATCH] Process: Clean up process table entry even when `kill(2)` fails with `ESRCH` (#10375) * Icinga daemon leaves zombie processes on very busy system On a very heavily loaded system the process group kill can be delayed until after the regular TERM signal has caused the process to exit. In this situation the waitpid call is valid and reaps the zombie process that would otherwise be left behind. * Update AUTHORS file --- AUTHORS | 1 + lib/base/process.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 73ab10637..4207f57f8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -242,6 +242,7 @@ pv2b Ralph Breier Reto Zeder Ricardo Bartels +Richard Mortimer Rinck H. Sonnenberg Robert Lindgren Robert Scheck diff --git a/lib/base/process.cpp b/lib/base/process.cpp index a076dcf32..23b735352 100644 --- a/lib/base/process.cpp +++ b/lib/base/process.cpp @@ -1087,7 +1087,9 @@ bool Process::DoEvents() Log(LogWarning, "Process") << "Couldn't kill the process group " << m_PID << " (" << PrettyPrintArguments(m_Arguments) << "): [errno " << error << "] " << strerror(error); - could_not_kill = true; + if (error != ESRCH) { + could_not_kill = true; + } } #endif /* _WIN32 */