From af4b652c80e7c2bc1b8a613e58ce4e41fb41b243 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Fri, 9 Jun 2023 15:02:21 +0000 Subject: [PATCH] *) mod_http2: fixed a bug in flushing pending data on an already closed connection that could lead to a busy loop, preventing the HTTP/2 session to close down successfully. Fixed PR 66624. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1910331 13f79535-47bb-0310-9956-ffa450edef68 --- changes-entries/h2_flush_fix.txt | 4 ++++ modules/http2/h2_session.c | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 changes-entries/h2_flush_fix.txt diff --git a/changes-entries/h2_flush_fix.txt b/changes-entries/h2_flush_fix.txt new file mode 100644 index 00000000000..b44a3319f67 --- /dev/null +++ b/changes-entries/h2_flush_fix.txt @@ -0,0 +1,4 @@ + *) mod_http2: fixed a bug in flushing pending data on an already closed + connection that could lead to a busy loop, preventing the HTTP/2 session + to close down successfully. Fixed PR 66624. + [Stefan Eissing] diff --git a/modules/http2/h2_session.c b/modules/http2/h2_session.c index 0ede886998f..1f37a36bf72 100644 --- a/modules/http2/h2_session.c +++ b/modules/http2/h2_session.c @@ -1281,8 +1281,11 @@ static apr_status_t h2_session_send(h2_session *session) goto cleanup; } } - if (h2_c1_io_needs_flush(&session->io)) { + if (h2_c1_io_needs_flush(&session->io) || + ngrv == NGHTTP2_ERR_WOULDBLOCK) { rv = h2_c1_io_assure_flushed(&session->io); + if (rv != APR_SUCCESS) + goto cleanup; pending = 0; } } -- 2.47.2