You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by yl...@apache.org on 2021/12/06 17:12:29 UTC

svn commit: r1895630 - /httpd/httpd/trunk/server/mpm/event/event.c

Author: ylavic
Date: Mon Dec  6 17:12:28 2021
New Revision: 1895630

URL: http://svn.apache.org/viewvc?rev=1895630&view=rev
Log:
mpm_event: Follow up to r1895553.

We can still kill processes above MaxSpareThreads at every maintenance cycle
unless there is not enough headromm in the scoreboard for a graceful restart.


Modified:
    httpd/httpd/trunk/server/mpm/event/event.c

Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1895630&r1=1895629&r2=1895630&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Mon Dec  6 17:12:28 2021
@@ -3187,7 +3187,8 @@ static void perform_idle_server_maintena
          * gracefully finishing processes may accumulate, filling up the
          * scoreboard. To avoid running out of scoreboard entries, we
          * don't shut down more processes if there are stopping ones
-         * already (i.e. active_daemons < total_daemons).
+         * already (i.e. active_daemons != total_daemons) and not enough
+         * slack space in the scoreboard for a graceful restart.
          *
          * XXX It would be nice if we could
          * XXX - kill processes without keepalive connections first
@@ -3195,20 +3196,25 @@ static void perform_idle_server_maintena
          * XXX   depending on server load, later be able to resurrect them
          *       or kill them
          */
-        int ignore = (retained->active_daemons < retained->total_daemons);
+        int do_kill = (retained->active_daemons == retained->total_daemons
+                       || (server_limit - retained->total_daemons >
+                           active_daemons_limit));
         ap_log_error(APLOG_MARK, APLOG_TRACE5, 0, ap_server_conf,
                      "%shutting down one child: "
                      "active daemons %d / active limit %d / "
                      "total daemons %d / ServerLimit %d / "
                      "idle threads %d / max workers %d",
-                     (ignore) ? "Not s" : "S",
+                     (do_kill) ? "S" : "Not s",
                      retained->active_daemons, active_daemons_limit,
                      retained->total_daemons, server_limit,
                      idle_thread_count, max_workers);
-        if (!ignore) {
+        if (do_kill) {
             ap_mpm_podx_signal(retained->buckets[child_bucket].pod,
                                AP_MPM_PODX_GRACEFUL);
         }
+        else {
+            /* Wait for dying daemon(s) to exit */
+        }
         retained->idle_spawn_rate[child_bucket] = 1;
     }
     else if (idle_thread_count < min_spare_threads / num_buckets) {