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/24 14:19:08 UTC
svn commit: r1365003 - in /httpd/httpd/branches/2.4.x: ./ CHANGES STATUS
server/mpm/event/event.c server/mpm/worker/worker.c
Author: trawick
Date: Tue Jul 24 12:19:08 2012
New Revision: 1365003
URL: http://svn.apache.org/viewvc?rev=1365003&view=rev
Log:
mpm_event, mpm_worker: Remain active amidst prevalent child process
resource shortages.
Submitted by: trawick
Reviewed by: jorton, rjung, jim
Modified:
httpd/httpd/branches/2.4.x/ (props changed)
httpd/httpd/branches/2.4.x/CHANGES
httpd/httpd/branches/2.4.x/STATUS
httpd/httpd/branches/2.4.x/server/mpm/event/event.c
httpd/httpd/branches/2.4.x/server/mpm/worker/worker.c
Propchange: httpd/httpd/branches/2.4.x/
------------------------------------------------------------------------------
Merged /httpd/httpd/trunk:r1363557,1364601
Modified: httpd/httpd/branches/2.4.x/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/CHANGES?rev=1365003&r1=1365002&r2=1365003&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/CHANGES [utf-8] (original)
+++ httpd/httpd/branches/2.4.x/CHANGES [utf-8] Tue Jul 24 12:19:08 2012
@@ -8,6 +8,9 @@ Changes with Apache 2.4.3
possible XSS for a site where untrusted users can upload files to
a location with MultiViews enabled. [Niels Heinen <heinenn google.com>]
+ *) mpm_event, mpm_worker: Remain active amidst prevalent child process
+ resource shortages. [Jeff Trawick]
+
*) Add "strict" and "warnings" pragmas to Perl scripts. [Rich Bowen]
*) Honor DefaultRuntimeDir for mutexes, socache and CGID socket.
Modified: httpd/httpd/branches/2.4.x/STATUS
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/STATUS?rev=1365003&r1=1365002&r2=1365003&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/STATUS (original)
+++ httpd/httpd/branches/2.4.x/STATUS Tue Jul 24 12:19:08 2012
@@ -125,16 +125,6 @@ PATCHES PROPOSED TO BACKPORT FROM TRUNK:
http://www.humbedooh.com/mods/mod_lua.patch (+CHANGES)
+1: humbedooh, rjung
- * mpm_event, mpm_worker: Remain active amidst prevalent child process
- resource shortages.
- (1363440 should be a prereq to avoid unnecessarily rapid
- creation of child processes in some situations)
- trunk patch: http://svn.apache.org/viewvc?rev=1363557&view=rev
- trunk patch: http://svn.apache.org/viewvc?rev=1364601&view=rev
- 2.4.x patch: trunk patch works
- +1: trawick, jorton, rjung
- +1 before r1364601 was added: jim
-
* apxs: Make apxs use LDFLAGS from config_vars.mk in addition to
CFLAGS and CPPFLAGS.
trunk patch: http://svn.apache.org/viewvc?view=revision&revision=1343094
Modified: httpd/httpd/branches/2.4.x/server/mpm/event/event.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/mpm/event/event.c?rev=1365003&r1=1365002&r2=1365003&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/mpm/event/event.c (original)
+++ httpd/httpd/branches/2.4.x/server/mpm/event/event.c Tue Jul 24 12:19:08 2012
@@ -166,6 +166,7 @@ static int ap_daemons_limit = 0;
static int max_workers = 0;
static int server_limit = 0;
static int thread_limit = 0;
+static int had_healthy_child = 0;
static int dying = 0;
static int workers_may_exit = 0;
static int start_thread_may_exit = 0;
@@ -2302,6 +2303,7 @@ static void perform_idle_server_maintena
int any_dying_threads = 0;
int any_dead_threads = 0;
int all_dead_threads = 1;
+ int child_threads_active = 0;
if (i >= retained->max_daemons_limit
&& totally_free_length == retained->idle_spawn_rate)
@@ -2336,10 +2338,11 @@ static void perform_idle_server_maintena
++idle_thread_count;
}
if (status >= SERVER_READY && status < SERVER_GRACEFUL) {
- ++active_thread_count;
+ ++child_threads_active;
}
}
}
+ active_thread_count += child_threads_active;
if (any_dead_threads
&& totally_free_length < retained->idle_spawn_rate
&& free_length < MAX_SPAWN_RATE
@@ -2363,6 +2366,9 @@ static void perform_idle_server_maintena
}
++free_length;
}
+ else if (child_threads_active == threads_per_child) {
+ had_healthy_child = 1;
+ }
/* XXX if (!ps->quiescing) is probably more reliable GLA */
if (!any_dying_threads) {
last_non_dead = i;
@@ -2371,21 +2377,23 @@ static void perform_idle_server_maintena
}
if (retained->sick_child_detected) {
- if (active_thread_count > 0) {
- /* some child processes appear to be working. don't kill the
- * whole server.
+ if (had_healthy_child) {
+ /* Assume this is a transient error, even though it may not be. Leave
+ * the server up in case it is able to serve some requests or the
+ * problem will be resolved.
*/
retained->sick_child_detected = 0;
}
else {
- /* looks like a basket case. give up.
+ /* looks like a basket case, as no child ever fully initialized; give up.
*/
shutdown_pending = 1;
child_fatal = 1;
ap_log_error(APLOG_MARK, APLOG_ALERT, 0,
- ap_server_conf, APLOGNO(00483)
- "No active workers found..."
- " Apache is exiting!");
+ ap_server_conf, APLOGNO(02324)
+ "A resource shortage or other unrecoverable failure "
+ "was encountered before any child process initialized "
+ "successfully... httpd is exiting!");
/* the child already logged the failure details */
return;
}
@@ -2838,6 +2846,7 @@ static int event_pre_config(apr_pool_t *
ap_daemons_limit = server_limit;
threads_per_child = DEFAULT_THREADS_PER_CHILD;
max_workers = ap_daemons_limit * threads_per_child;
+ had_healthy_child = 0;
ap_extended_status = 0;
return OK;
Modified: httpd/httpd/branches/2.4.x/server/mpm/worker/worker.c
URL: http://svn.apache.org/viewvc/httpd/httpd/branches/2.4.x/server/mpm/worker/worker.c?rev=1365003&r1=1365002&r2=1365003&view=diff
==============================================================================
--- httpd/httpd/branches/2.4.x/server/mpm/worker/worker.c (original)
+++ httpd/httpd/branches/2.4.x/server/mpm/worker/worker.c Tue Jul 24 12:19:08 2012
@@ -122,6 +122,7 @@ static int ap_daemons_limit = 0;
static int max_workers = 0;
static int server_limit = 0;
static int thread_limit = 0;
+static int had_healthy_child = 0;
static int dying = 0;
static int workers_may_exit = 0;
static int start_thread_may_exit = 0;
@@ -1473,6 +1474,7 @@ static void perform_idle_server_maintena
int any_dying_threads = 0;
int any_dead_threads = 0;
int all_dead_threads = 1;
+ int child_threads_active = 0;
if (i >= retained->max_daemons_limit && totally_free_length == retained->idle_spawn_rate)
/* short cut if all active processes have been examined and
@@ -1506,10 +1508,11 @@ static void perform_idle_server_maintena
++idle_thread_count;
}
if (status >= SERVER_READY && status < SERVER_GRACEFUL) {
- ++active_thread_count;
+ ++child_threads_active;
}
}
}
+ active_thread_count += child_threads_active;
if (any_dead_threads && totally_free_length < retained->idle_spawn_rate
&& free_length < MAX_SPAWN_RATE
&& (!ps->pid /* no process in the slot */
@@ -1532,6 +1535,9 @@ static void perform_idle_server_maintena
}
++free_length;
}
+ else if (child_threads_active == threads_per_child) {
+ had_healthy_child = 1;
+ }
/* XXX if (!ps->quiescing) is probably more reliable GLA */
if (!any_dying_threads) {
last_non_dead = i;
@@ -1540,21 +1546,23 @@ static void perform_idle_server_maintena
}
if (retained->sick_child_detected) {
- if (active_thread_count > 0) {
- /* some child processes appear to be working. don't kill the
- * whole server.
+ if (had_healthy_child) {
+ /* Assume this is a transient error, even though it may not be. Leave
+ * the server up in case it is able to serve some requests or the
+ * problem will be resolved.
*/
retained->sick_child_detected = 0;
}
else {
- /* looks like a basket case. give up.
+ /* looks like a basket case, as no child ever fully initialized; give up.
*/
shutdown_pending = 1;
child_fatal = 1;
ap_log_error(APLOG_MARK, APLOG_ALERT, 0,
- ap_server_conf, APLOGNO(00285)
- "No active workers found..."
- " Apache is exiting!");
+ ap_server_conf, APLOGNO(02325)
+ "A resource shortage or other unrecoverable failure "
+ "was encountered before any child process initialized "
+ "successfully... httpd is exiting!");
/* the child already logged the failure details */
return;
}
@@ -2020,6 +2028,7 @@ static int worker_pre_config(apr_pool_t
ap_daemons_limit = server_limit;
threads_per_child = DEFAULT_THREADS_PER_CHILD;
max_workers = ap_daemons_limit * threads_per_child;
+ had_healthy_child = 0;
ap_extended_status = 0;
return OK;