File apache2-mod_http2-terminate-child-processes-on-graceful-reload.patch of Package apache2.40370
From 81595a39487b843881445f0e74ba90f09179a2c3 Mon Sep 17 00:00:00 2001
From: Stefan Eissing <icing@apache.org>
Date: Thu, 4 Nov 2021 09:42:45 +0000
Subject: [PATCH] * mod_http2: a regression in v1.15.24 of the modules was
fixed that could lead to httpd child processes not being terminated on a
graceful reload or when reaching MaxConnectionsPerChild. When
unprocessed h2 requests were queued at the time, these could stall. See
<https://github.com/icing/mod_h2/issues/212>. [@hansborr, @famzah, Stefan
Eissing]
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1894728 13f79535-47bb-0310-9956-ffa450edef68
---
changes-entries/h2_graceful_stall.txt | 6 ++++++
modules/http2/h2_session.c | 4 ++--
modules/http2/h2_workers.c | 2 --
3 files changed, 8 insertions(+), 4 deletions(-)
create mode 100644 changes-entries/h2_graceful_stall.txt
diff --git a/changes-entries/h2_graceful_stall.txt b/changes-entries/h2_graceful_stall.txt
new file mode 100644
index 0000000000..b0d054a524
--- /dev/null
+++ b/changes-entries/h2_graceful_stall.txt
@@ -0,0 +1,6 @@
+ * mod_http2: a regression in v1.15.24 of the modules was fixed that
+ could lead to httpd child processes not being terminated on a
+ graceful reload or when reaching MaxConnectionsPerChild.
+ When unprocessed h2 requests were queued at the time, these could stall.
+ See <https://github.com/icing/mod_h2/issues/212>.
+ [@hansborr, @famzah, Stefan Eissing]
diff --git a/modules/http2/h2_session.c b/modules/http2/h2_session.c
index f17f1d92b8..812ad91a22 100644
--- a/modules/http2/h2_session.c
+++ b/modules/http2/h2_session.c
@@ -277,7 +277,7 @@ static int on_begin_headers_cb(nghttp2_session *ngh2,
const nghttp2_frame *frame, void *userp)
{
h2_session *session = (h2_session *)userp;
- h2_stream *s;
+ h2_stream *s = NULL;
/* We may see HEADERs at the start of a stream or after all DATA
* streams to carry trailers. */
@@ -286,7 +286,7 @@ static int on_begin_headers_cb(nghttp2_session *ngh2,
if (s) {
/* nop */
}
- else {
+ else if (session->local.accepting) {
s = h2_session_open_stream(userp, frame->hd.stream_id, 0);
}
return s? 0 : NGHTTP2_ERR_START_STREAM_NOT_ALLOWED;
diff --git a/modules/http2/h2_workers.c b/modules/http2/h2_workers.c
index 6b9f5a3540..8b53cf9ab4 100644
--- a/modules/http2/h2_workers.c
+++ b/modules/http2/h2_workers.c
@@ -461,8 +461,6 @@ apr_status_t h2_workers_unregister(h2_workers *workers, struct h2_mplx *m)
void h2_workers_graceful_shutdown(h2_workers *workers)
{
workers->shutdown = 1;
- workers->min_workers = 1;
workers->max_idle_duration = apr_time_from_sec(1);
- h2_fifo_term(workers->mplxs);
wake_non_essential_workers(workers);
}
--
2.34.1