Index: server/mpm/event/event.c =================================================================== --- server/mpm/event/event.c (revision 1897009) +++ server/mpm/event/event.c (working copy) @@ -2766,11 +2766,11 @@ static int make_child(server_rec * s, int slot, in } /* start up a bunch of children */ -static void startup_children(int number_to_start) +static void startup_children(void) { int i; - for (i = 0; number_to_start && i < server_limit; ++i) { + for (i = 0; ap_daemons_to_start && i < server_limit; ++i) { if (ap_scoreboard_image->parent[i].pid != 0) { continue; } @@ -2777,7 +2777,7 @@ static int make_child(server_rec * s, int slot, in if (make_child(ap_server_conf, i, i % retained->mpm->num_buckets) < 0) { break; } - --number_to_start; + --ap_daemons_to_start; } } @@ -2989,9 +2989,10 @@ static void perform_idle_server_maintenance(int ch } } -static void server_main_loop(int remaining_children_to_start) +static void server_main_loop(void) { int num_buckets = retained->mpm->num_buckets; + int startup_children_done = 0; int child_slot; apr_exit_why_e exitwhy; int status, processed_status; @@ -3054,13 +3055,13 @@ static void perform_idle_server_maintenance(int ch /* resource shortage, minimize the fork rate */ retained->idle_spawn_rate[child_slot % num_buckets] = 1; } - else if (remaining_children_to_start) { + else if (ap_daemons_to_start) { /* we're still doing a 1-for-1 replacement of dead * children with new children */ make_child(ap_server_conf, child_slot, child_slot % num_buckets); - --remaining_children_to_start; + --ap_daemons_to_start; } } #if APR_HAS_OTHER_CHILD @@ -3085,13 +3086,13 @@ static void perform_idle_server_maintenance(int ch */ continue; } - else if (remaining_children_to_start) { + else if (ap_daemons_to_start && !startup_children_done) { /* we hit a 1 second timeout in which none of the previous * generation of children needed to be reaped... so assume * they're all done, and pick up the slack if any is left. */ - startup_children(remaining_children_to_start); - remaining_children_to_start = 0; + startup_children(); + startup_children_done = 1; /* In any event we really shouldn't do the code below because * few of the servers we just started are in the IDLE state * yet, so we'd mistakenly create an extra server. @@ -3108,7 +3109,6 @@ static void perform_idle_server_maintenance(int ch static int event_run(apr_pool_t * _pconf, apr_pool_t * plog, server_rec * s) { int num_buckets = retained->mpm->num_buckets; - int remaining_children_to_start; int i; ap_log_pid(pconf, ap_pid_fname); @@ -3153,13 +3153,12 @@ static int event_run(apr_pool_t * _pconf, apr_pool * that, so we'll just keep track of how many we're * supposed to start up without the 1 second penalty between each fork. */ - remaining_children_to_start = ap_daemons_to_start; - if (remaining_children_to_start > active_daemons_limit) { - remaining_children_to_start = active_daemons_limit; + if (ap_daemons_to_start > active_daemons_limit) { + ap_daemons_to_start = active_daemons_limit; } if (!retained->mpm->was_graceful) { - startup_children(remaining_children_to_start); - remaining_children_to_start = 0; + startup_children(); + ap_daemons_to_start = 0; } else { /* give the system some time to recover before kicking into @@ -3177,7 +3176,7 @@ static int event_run(apr_pool_t * _pconf, apr_pool retained->mpm->mpm_state = AP_MPMQ_RUNNING; - server_main_loop(remaining_children_to_start); + server_main_loop(); retained->mpm->mpm_state = AP_MPMQ_STOPPING; if (retained->mpm->shutdown_pending && retained->mpm->is_ungraceful) {