[nginx] HTTP/2: close connections initialized during graceful shutdown.

Roman Arutyunyan arut at nginx.com
Thu Jul 18 13:49:07 UTC 2024


details:   https://hg.nginx.org/nginx/rev/d1b8568f3042
branches:  
changeset: 9270:d1b8568f3042
user:      Kasei Wang <kasei at kasei.im>
date:      Thu Jul 18 17:43:25 2024 +0400
description:
HTTP/2: close connections initialized during graceful shutdown.

In some rare cases, graceful shutdown may happen while initializing an HTTP/2
connection.  Previously, such a connection ignored the shutdown and remained
active.  Now it is gracefully closed prior to processing any streams to
eliminate the shutdown delay.

diffstat:

 src/http/v2/ngx_http_v2.c |  5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diffs (15 lines):

diff -r 072ca4906154 -r d1b8568f3042 src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c	Thu Jun 27 17:29:56 2024 +0400
+++ b/src/http/v2/ngx_http_v2.c	Thu Jul 18 17:43:25 2024 +0400
@@ -292,6 +292,11 @@ ngx_http_v2_init(ngx_event_t *rev)
 
     c->data = h2c;
 
+    if (ngx_exiting) {
+        ngx_http_v2_finalize_connection(h2c, NGX_HTTP_V2_NO_ERROR);
+        return;
+    }
+
     rev->handler = ngx_http_v2_read_handler;
     c->write->handler = ngx_http_v2_write_handler;
 


More information about the nginx-devel mailing list