From: Alex Rousskov Date: Thu, 28 Apr 2022 10:37:56 +0000 (+0000) Subject: Bug 5208: Part 1: Restart kids killed by SIGKILL (#1035) X-Git-Tag: SQUID_5_6~3 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=79ff41c6f2cd5c0dbef15929566d3d72da83eb64;p=thirdparty%2Fsquid.git Bug 5208: Part 1: Restart kids killed by SIGKILL (#1035) OOM killer uses SIGKILL. Squid did not restart kids killed by SIGKILL. Kids are essential Squid components. Essential components should be revived (by default) because providing a service without an essential component would violate Squid functionality requirements. Squid did not revive a kid killed by SIGKILL because we thought that doing so will interfere with the "squid -k kill" feature that uses that signal to kill the whole Squid instance. However, that feature does not actually work[^1] -- the signal is sent to (and kills) the master process only, the process which PID is in squid.pid file. This change is orthogonal to fixing "squid -k kill" (a difficult out-of-scope project). [^1]: Except in the special case of the no-daemon (squid -N) mode. --- diff --git a/src/ipc/Kid.cc b/src/ipc/Kid.cc index 8c3c7215c0..e2d31dae82 100644 --- a/src/ipc/Kid.cc +++ b/src/ipc/Kid.cc @@ -100,7 +100,6 @@ bool Kid::shouldRestart() const exitedHappy() || hopeless() || shutting_down || - signaled(SIGKILL) || // squid -k kill signaled(SIGINT) || // unexpected forced shutdown signaled(SIGTERM)); // unexpected forced shutdown } diff --git a/src/main.cc b/src/main.cc index a30ba6b3fd..080e71a1a4 100644 --- a/src/main.cc +++ b/src/main.cc @@ -568,6 +568,7 @@ mainHandleCommandLineOption(const int optId, const char *optValue) /** \li On interrupt send SIGINT. */ opt_send_signal = SIGINT; else if (!strncmp(optValue, "kill", strlen(optValue))) + // XXX: In SMP mode, uncatchable SIGKILL only kills the master process /** \li On kill send SIGKILL. */ opt_send_signal = SIGKILL;