]> git.ipfire.org Git - thirdparty/apache/httpd.git/commitdiff
mpm_event, mpm_worker: Fix cases where the spawn rate wasn't reduced
authorJeff Trawick <trawick@apache.org>
Thu, 19 Jul 2012 17:54:13 +0000 (17:54 +0000)
committerJeff Trawick <trawick@apache.org>
Thu, 19 Jul 2012 17:54:13 +0000 (17:54 +0000)
after child process resource shortages.

The broken scenario:

  child X exits with APEXIT_CHILDSICK
  another child Y is created and reuses child X's scoreboard slot
  child X's exit status is processed

The case that worked is when child X's scoreboard slot hadn't
been reused by the time that its exit status was processed.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1363440 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
server/mpm/event/event.c
server/mpm/worker/worker.c

diff --git a/CHANGES b/CHANGES
index 678992533995eedccbce0c29ae35effa44d4695c..38f7db0921e9724bf232c6f4bbd408c98f64d0c3 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mpm_event, mpm_worker: Fix cases where the spawn rate wasn't reduced
+     after child process resource shortages.  [Jeff Trawick]
+
   *) mpm_prefork: Reduce spawn rate after a child process exits due to
      unexpected poll or accept failure.  [Jeff Trawick]
 
index 4bfc221e22e9cabedb20d6e6089321c50e303c54..2c137cd74868e912914672958a08027a42d4b340 100644 (file)
@@ -2619,6 +2619,11 @@ static void server_main_loop(int remaining_children_to_start)
 
                 event_note_child_killed(-1, /* already out of the scoreboard */
                                         pid.pid, old_gen);
+                if (processed_status == APEXIT_CHILDSICK
+                    && old_gen == retained->my_generation) {
+                    /* resource shortage, minimize the fork rate */
+                    retained->idle_spawn_rate = 1;
+                }
 #if APR_HAS_OTHER_CHILD
             }
             else if (apr_proc_other_child_alert(&pid, APR_OC_REASON_DEATH,
index 75f15ebd017ff3b6406454d7416f27f1a45ed498..5a279c9e0ae68facff59d4b91ca521570f2bc96d 100644 (file)
@@ -1699,6 +1699,11 @@ static void server_main_loop(int remaining_children_to_start)
             else if (ap_unregister_extra_mpm_process(pid.pid, &old_gen) == 1) {
                 worker_note_child_killed(-1, /* already out of the scoreboard */
                                          pid.pid, old_gen);
+                if (processed_status == APEXIT_CHILDSICK
+                    && old_gen == retained->my_generation) {
+                    /* resource shortage, minimize the fork rate */
+                    retained->idle_spawn_rate = 1;
+                }
 #if APR_HAS_OTHER_CHILD
             }
             else if (apr_proc_other_child_alert(&pid, APR_OC_REASON_DEATH,