ASF Bugzilla – Attachment 38244 Details for
Bug 66004
Child processes disappears one by one with no web access.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix active/total daemons accounting on non-graceful restart
2.4.x-event_note_child_killed-v1.diff (text/plain), 6.50 KB, created by
Yann Ylavic
on 2022-04-11 13:58:31 UTC
(
hide
)
Description:
Fix active/total daemons accounting on non-graceful restart
Filename:
MIME Type:
Creator:
Yann Ylavic
Created:
2022-04-11 13:58:31 UTC
Size:
6.50 KB
patch
obsolete
>Index: server/mpm/event/event.c >=================================================================== >--- server/mpm/event/event.c (revision 1898789) >+++ server/mpm/event/event.c (working copy) >@@ -699,11 +699,26 @@ static int event_query(int query_code, int *result > static void event_note_child_killed(int childnum, pid_t pid, ap_generation_t gen) > { > if (childnum != -1) { /* child had a scoreboard slot? */ >- ap_run_child_status(ap_server_conf, >- ap_scoreboard_image->parent[childnum].pid, >- ap_scoreboard_image->parent[childnum].generation, >+ process_score *ps = &ap_scoreboard_image->parent[childnum]; >+ int i; >+ >+ for (i = 0; i < threads_per_child; i++) >+ ap_update_child_status_from_indexes(childnum, i, >+ SERVER_DEAD, NULL); >+ ap_run_child_status(ap_server_conf, ps->pid, ps->generation, > childnum, MPM_CHILD_EXITED); >- ap_scoreboard_image->parent[childnum].pid = 0; >+ >+ if (ps->quiescing != 2) { >+ retained->active_daemons--; >+ } >+ retained->total_daemons--; >+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, >+ "Child %d/%d stopped: active %d/%d, total %d/%d/%d, quiescing %d", >+ ps->pid, childnum, retained->active_daemons, active_daemons_limit, >+ retained->total_daemons, retained->max_daemons_limit, server_limit, >+ ps->quiescing); >+ ps->quiescing = 0; >+ ps->pid = 0; > } > else { > ap_run_child_status(ap_server_conf, pid, gen, -1, MPM_CHILD_EXITED); >@@ -715,7 +730,16 @@ static void event_note_child_started(int slot, pid > ap_generation_t gen = retained->mpm->my_generation; > ap_scoreboard_image->parent[slot].pid = pid; > ap_scoreboard_image->parent[slot].generation = gen; >+ ap_scoreboard_image->parent[slot].quiescing = 0; >+ ap_scoreboard_image->parent[slot].not_accepting = 0; > ap_run_child_status(ap_server_conf, pid, gen, slot, MPM_CHILD_STARTED); >+ retained->active_daemons++; >+ retained->total_daemons++; >+ >+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, >+ "Child %d/%d started: active %d/%d, total %d/%d/%d", >+ pid, slot, retained->active_daemons, active_daemons_limit, >+ retained->total_daemons, retained->max_daemons_limit, server_limit); > } > > static const char *event_get_name(void) >@@ -2781,11 +2805,7 @@ static int make_child(server_rec * s, int slot, in > return -1; > } > >- ap_scoreboard_image->parent[slot].quiescing = 0; >- ap_scoreboard_image->parent[slot].not_accepting = 0; > event_note_child_started(slot, pid); >- retained->active_daemons++; >- retained->total_daemons++; > return 0; > } > >@@ -2835,6 +2855,10 @@ static void perform_idle_server_maintenance(int ch > if (ps->quiescing == 1) { > ps->quiescing = 2; > retained->active_daemons--; >+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, ap_server_conf, >+ "Child %d/%d quiescing: active %d/%d, total %d/%d/%d", >+ ps->pid, i, retained->active_daemons, active_daemons_limit, >+ retained->total_daemons, retained->max_daemons_limit, server_limit); > } > for (j = 0; j < threads_per_child; j++) { > int status = ap_scoreboard_image->servers[i][j].status; >@@ -2974,6 +2998,9 @@ static void perform_idle_server_maintenance(int ch > "rate %d", free_length, > retained->active_daemons, active_daemons_limit, > retained->idle_spawn_rate[child_bucket]); >+ /* reset the spawning rate and prevent its growth below */ >+ retained->idle_spawn_rate[child_bucket] = 1; >+ ++retained->hold_off_on_exponential_spawning; > free_length = 0; > } > } >@@ -3061,19 +3088,8 @@ static void server_main_loop(int remaining_childre > } > /* non-fatal death... note that it's gone in the scoreboard. */ > if (child_slot >= 0) { >- process_score *ps; >+ event_note_child_killed(child_slot, 0, 0); > >- for (i = 0; i < threads_per_child; i++) >- ap_update_child_status_from_indexes(child_slot, i, >- SERVER_DEAD, NULL); >- >- event_note_child_killed(child_slot, 0, 0); >- ps = &ap_scoreboard_image->parent[child_slot]; >- if (ps->quiescing != 2) >- retained->active_daemons--; >- ps->quiescing = 0; >- /* NOTE: We don't dec in the (child_slot < 0) case! */ >- retained->total_daemons--; > if (processed_status == APEXIT_CHILDSICK) { > /* resource shortage, minimize the fork rate */ > retained->idle_spawn_rate[child_slot % num_buckets] = 1; >@@ -3302,8 +3318,8 @@ static int event_run(apr_pool_t * _pconf, apr_pool > > if (!retained->mpm->is_ungraceful) { > ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, APLOGNO(00493) >- AP_SIG_GRACEFUL_STRING >- " received. Doing graceful restart"); >+ AP_SIG_GRACEFUL_STRING " received. Doing graceful restart"); >+ > /* wake up the children...time to die. But we'll have more soon */ > for (i = 0; i < num_buckets; i++) { > ap_mpm_podx_killpg(all_buckets[i].pod, active_daemons_limit, >@@ -3316,6 +3332,9 @@ static int event_run(apr_pool_t * _pconf, apr_pool > > } > else { >+ ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, APLOGNO(00494) >+ "SIGHUP received. Attempting to restart"); >+ > /* Kill 'em all. Since the child acts the same on the parents SIGTERM > * and a SIGHUP, we may as well use the same signal, because some user > * pthreads are stealing signals from us left and right. >@@ -3327,8 +3346,6 @@ static int event_run(apr_pool_t * _pconf, apr_pool > > ap_reclaim_child_processes(1, /* Start with SIGTERM */ > event_note_child_killed); >- ap_log_error(APLOG_MARK, APLOG_NOTICE, 0, ap_server_conf, APLOGNO(00494) >- "SIGHUP received. Attempting to restart"); > } > > return OK;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 66004
:
38243
| 38244 |
38245