From: Jeff Trawick Date: Thu, 19 Jul 2012 17:54:13 +0000 (+0000) Subject: mpm_event, mpm_worker: Fix cases where the spawn rate wasn't reduced X-Git-Tag: 2.5.0-alpha~6619 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b1e88d285c2e0a583b6b8b28148c92ad907d4f1;p=thirdparty%2Fapache%2Fhttpd.git 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. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1363440 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 67899253399..38f7db0921e 100644 --- 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] diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index 4bfc221e22e..2c137cd7486 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -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, diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c index 75f15ebd017..5a279c9e0ae 100644 --- a/server/mpm/worker/worker.c +++ b/server/mpm/worker/worker.c @@ -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,