You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ic...@apache.org on 2022/05/25 12:09:37 UTC
svn commit: r1901234 - in /httpd/httpd/branches/2.4.x: ./ changes-entries/event_early_killed_children.txt server/mpm/event/event.c server/mpm/worker/worker.c
Author: icing
Date: Wed May 25 12:09:36 2022
New Revision: 1901234
URL: http://svn.apache.org/viewvc?rev=1901234&view=rev
Log:
Merge /httpd/httpd/trunk:r1899858,1899865,1899884,1900991
*) mpm_event, mpm_worker: Handle children killed pathologically.
Added:
httpd/httpd/branches/2.4.x/changes-entries/event_early_killed_children.txt
- copied unchanged from r1900991, httpd/httpd/trunk/changes-entries/event_early_killed_children.txt
Modified:
httpd/httpd/branches/2.4.x/ (props changed)
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:r1899858,1899865,1899884,1900991
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=1901234&r1=1901233&r2=1901234&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 Wed May 25 12:09:36 2022
@@ -3058,6 +3058,7 @@ static void server_main_loop(int remaini
{
int num_buckets = retained->mpm->num_buckets;
int max_daemon_used = 0;
+ int successive_kills = 0;
int child_slot;
apr_exit_why_e exitwhy;
int status, processed_status;
@@ -3136,11 +3137,30 @@ static void server_main_loop(int remaini
/* 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.
+ * 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).
*/
- continue;
+ if (child_slot < 0 || !APR_PROC_CHECK_SIGNALED(exitwhy)) {
+ continue;
+ }
+ 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!");
+ }
+ continue;
+ }
+ ++remaining_children_to_start;
}
- else if (remaining_children_to_start) {
+ else {
+ successive_kills = 0;
+ }
+
+ if (remaining_children_to_start) {
/* 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.
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=1901234&r1=1901233&r2=1901234&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 Wed May 25 12:09:36 2022
@@ -1590,6 +1590,7 @@ static void perform_idle_server_maintena
static void server_main_loop(int remaining_children_to_start)
{
int num_buckets = retained->mpm->num_buckets;
+ int successive_kills = 0;
ap_generation_t old_gen;
int child_slot;
apr_exit_why_e exitwhy;
@@ -1684,11 +1685,30 @@ static void server_main_loop(int remaini
/* 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.
+ * 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).
*/
- continue;
+ if (child_slot < 0 || !APR_PROC_CHECK_SIGNALED(exitwhy)) {
+ continue;
+ }
+ 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!");
+ }
+ continue;
+ }
+ ++remaining_children_to_start;
}
- else if (remaining_children_to_start) {
+ else {
+ successive_kills = 0;
+ }
+
+ if (remaining_children_to_start) {
/* 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.