From 726b575cd7919486b9922f34ebb027ae3b659e7f Mon Sep 17 00:00:00 2001 From: chengyechun Date: Tue, 13 Sep 2022 15:29:52 +0800 Subject: [PATCH] update some upstream patches --- ...andle-children-killed-pathologically.patch | 92 +++++++++++++++++++ ...umeric-check-for-HeartbeatMaxServers.patch | 31 +++++++ httpd.spec | 11 ++- 3 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 backport-Handle-children-killed-pathologically.patch create mode 100644 backport-fix-numeric-check-for-HeartbeatMaxServers.patch diff --git a/backport-Handle-children-killed-pathologically.patch b/backport-Handle-children-killed-pathologically.patch new file mode 100644 index 0000000..1515dbd --- /dev/null +++ b/backport-Handle-children-killed-pathologically.patch @@ -0,0 +1,92 @@ +From 5f3010a643ac7c67b733484797d41366e328ecdb Mon Sep 17 00:00:00 2001 +From: icing +Date: Tue, 30 Aug 2022 14:47:19 UTC +Subject: [PATCH] Handle children killed pathologically + +Conflict:NA +Reference:https://github.com/apache/httpd/commit/5f3010a643ac7c67b733484797d41366e328ecdb + +--- + server/mpm/event/event.c | 19 +++++++++++++++++-- + server/mpm/worker/worker.c | 19 +++++++++++++++++-- + 2 files changed, 34 insertions(+), 4 deletions(-) + +diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c +index dddff35..77a373b 100644 +--- a/server/mpm/event/event.c ++++ b/server/mpm/event/event.c +@@ -2984,6 +2984,7 @@ static void perform_idle_server_maintenance(int child_bucket, int num_buckets) + static void server_main_loop(int remaining_children_to_start, int num_buckets) + { + int child_slot; ++ int successive_kills = 0; + apr_exit_why_e exitwhy; + int status, processed_status; + apr_proc_t pid; +@@ -3074,9 +3075,23 @@ static void server_main_loop(int remaining_children_to_start, int num_buckets) + * finite number of children can die, and it's pretty + * pathological for a lot to die suddenly. + */ +- 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) ++ "childred are killed successively"); ++ } ++ continue; ++ } ++ ++remaining_children_to_start; ++ } ++ else { ++ successive_kills = 0; + } +- else if (remaining_children_to_start) { ++ 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. +diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c +index bd56f61..066a22f 100644 +--- a/server/mpm/worker/worker.c ++++ b/server/mpm/worker/worker.c +@@ -1570,6 +1570,7 @@ static void perform_idle_server_maintenance(int child_bucket, int num_buckets) + static void server_main_loop(int remaining_children_to_start, int num_buckets) + { + ap_generation_t old_gen; ++ int successive_kills = 0; + int child_slot; + apr_exit_why_e exitwhy; + int status, processed_status; +@@ -1665,9 +1666,23 @@ static void server_main_loop(int remaining_children_to_start, int num_buckets) + * finite number of children can die, and it's pretty + * pathological for a lot to die suddenly. + */ +- 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 { ++ successive_kills = 0; + } +- else if (remaining_children_to_start) { ++ 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. +-- +2.23.0 + diff --git a/backport-fix-numeric-check-for-HeartbeatMaxServers.patch b/backport-fix-numeric-check-for-HeartbeatMaxServers.patch new file mode 100644 index 0000000..13696e8 --- /dev/null +++ b/backport-fix-numeric-check-for-HeartbeatMaxServers.patch @@ -0,0 +1,31 @@ +From 938554adf4cc6bd99e26ec325d234d695bb73366 Mon Sep 17 00:00:00 2001 +From: Jim Jagielski +Date: Wed, 22 Aug 2022 04:29:36 +0800 +Subject: [PATCH] fix numeric check for HeartbeatMaxServers + +Conflict:NA +Reference:https://github.com/apache/httpd/commit/938554adf4cc6bd99e26ec325d234d695bb73366 + +--- + modules/cluster/mod_heartmonitor.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/modules/cluster/mod_heartmonitor.c b/modules/cluster/mod_heartmonitor.c +index 30db11a..73668fa 100644 +--- a/modules/cluster/mod_heartmonitor.c ++++ b/modules/cluster/mod_heartmonitor.c +@@ -892,8 +892,9 @@ static const char *cmd_hm_maxworkers(cmd_parms *cmd, + } + + maxworkers = atoi(data); +- if (maxworkers <= 10) +- return "HeartbeatMaxServers: Should be bigger than 10"; ++ if (maxworkers != 0 && maxworkers < 10) ++ return "HeartbeatMaxServers: Should be 0 for file storage, " ++ "or greater or equal than 10 for slotmem"; + + return NULL; + } +-- +2.23.0 + diff --git a/httpd.spec b/httpd.spec index 7ba154a..c2fac04 100644 --- a/httpd.spec +++ b/httpd.spec @@ -8,7 +8,7 @@ Name: httpd Summary: Apache HTTP Server Version: 2.4.51 -Release: 10 +Release: 11 License: ASL 2.0 URL: https://httpd.apache.org/ Source0: https://archive.apache.org/dist/httpd/httpd-%{version}.tar.bz2 @@ -91,6 +91,8 @@ Patch37: backport-fix-error-HeartbeatMaxServers-default-value.patch Patch38: backport-fix-lua-request-with-cast-first.patch Patch39: backport-fix-setting-and-comparison-of-IPs-fields.patch Patch40: backport-make-ap_escape_quotes-work-correctly.patch +Patch41: backport-Handle-children-killed-pathologically.patch +Patch42: backport-fix-numeric-check-for-HeartbeatMaxServers.patch BuildRequires: gcc autoconf pkgconfig findutils xmlto perl-interpreter perl-generators systemd-devel BuildRequires: zlib-devel libselinux-devel lua-devel brotli-devel @@ -523,6 +525,13 @@ exit $rv %{_rpmconfigdir}/macros.d/macros.httpd %changelog +* Wed Sep 7 2022 chengyechun - 2.4.51-11 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:core:Handle children killed pathologically + mod_heartmoniter:fix numeric check for HeartbeatMaxServers + * Mon Sep 5 2022 chengyechun - 2.4.51-10 - Type:bugfix - ID:NA -- Gitee