You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2012/07/19 19:54:14 UTC

svn commit: r1363440 - in /httpd/httpd/trunk: CHANGES server/mpm/event/event.c server/mpm/worker/worker.c

Author: trawick
Date: Thu Jul 19 17:54:13 2012
New Revision: 1363440

URL: http://svn.apache.org/viewvc?rev=1363440&view=rev
Log:
mpm_event, mpm_worker: Fix cases where the spawn rate wasn't reduced
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.

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

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1363440&r1=1363439&r2=1363440&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Thu Jul 19 17:54:13 2012
@@ -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]
 

Modified: httpd/httpd/trunk/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/event/event.c?rev=1363440&r1=1363439&r2=1363440&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/event/event.c (original)
+++ httpd/httpd/trunk/server/mpm/event/event.c Thu Jul 19 17:54:13 2012
@@ -2619,6 +2619,11 @@ static void server_main_loop(int remaini
 
                 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,

Modified: httpd/httpd/trunk/server/mpm/worker/worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/mpm/worker/worker.c?rev=1363440&r1=1363439&r2=1363440&view=diff
==============================================================================
--- httpd/httpd/trunk/server/mpm/worker/worker.c (original)
+++ httpd/httpd/trunk/server/mpm/worker/worker.c Thu Jul 19 17:54:13 2012
@@ -1699,6 +1699,11 @@ static void server_main_loop(int remaini
             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,