diff options
author | Yann Ylavic <ylavic@apache.org> | 2022-04-14 19:04:08 +0200 |
---|---|---|
committer | Yann Ylavic <ylavic@apache.org> | 2022-04-14 19:04:08 +0200 |
commit | 64dfe45db61356a25d86f37c3dcf562070e78d2b (patch) | |
tree | 373d4b745a908f9941681ae2c1460fbf8624f6ba /server | |
parent | test/core: Allow for 12 simultaneous connections in test_core_002_01. (diff) | |
download | apache2-64dfe45db61356a25d86f37c3dcf562070e78d2b.tar.xz apache2-64dfe45db61356a25d86f37c3dcf562070e78d2b.zip |
mpm_event: Follow up to r1899858: Avoid explicit sleep.
Instead, we can simply go to ap_wait_or_timeout() again.
While at it, improve the comment about killed processes.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1899865 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server')
-rw-r--r-- | server/mpm/event/event.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index b4361cc898..2611d33f69 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -3382,7 +3382,7 @@ static void server_main_loop(int remaining_children_to_start) { int num_buckets = retained->mpm->num_buckets; int max_daemon_used = 0; - int successive_signals = 0; + int successive_kills = 0; int child_slot; apr_exit_why_e exitwhy; int status, processed_status; @@ -3461,28 +3461,27 @@ static void server_main_loop(int remaining_children_to_start) /* Don't perform idle maintenance when a child dies, * only do it when there's a timeout. Remember only a * finite number of children can die, and it's pretty - * pathological for a lot to die suddenly. If that happens - * anyway, protect against fork()+kill() flood by not restarting - * more than 3 children if no timeout happened in between, - * otherwise we keep going with idle maintenance. + * pathological for a lot to die suddenly. If a child is + * killed by a signal (faulting) we want to restart it ASAP + * though, up to 3 successive faults or we stop this until + * a timeout happens again (to avoid the flood of fork()ed + * processes that keep being killed early). */ if (child_slot < 0 || !APR_PROC_CHECK_SIGNALED(exitwhy)) { continue; } - if (++successive_signals >= 3) { - if (successive_signals % 10 == 3) { + if (++successive_kills >= 3) { + if (successive_kills % 10 == 3) { ap_log_error(APLOG_MARK, APLOG_WARNING, 0, ap_server_conf, APLOGNO(10392) "children are killed successively!"); } - apr_sleep(apr_time_from_sec(1)); - } - else { - ++remaining_children_to_start; + continue; } + ++remaining_children_to_start; } else { - successive_signals = 0; + successive_kills = 0; } if (remaining_children_to_start) { |