Maxim Dounin
February 11, 2021 02:58PM
details: https://hg.nginx.org/nginx/rev/0a5687a458de
branches:
changeset: 7769:0a5687a458de
user: Maxim Dounin <mdounin@mdounin.ru>
date: Thu Feb 11 21:52:17 2021 +0300
description:
HTTP/2: fixed reusing connections with active requests.

New connections are marked reusable by ngx_http_init_connection() if there
are no data available for reading. As a result, if SSL is not used,
ngx_http_v2_init() might be called when the connection is marked reusable.
If a HEADERS frame is immediately available for reading, this resulted
in connection being preserved in reusable state with an active request,
and possibly closed later as if during worker shutdown (that is, after
all active requests were finalized).

Fix is to explicitly mark connections non-reusable in ngx_http_v2_init()
instead of (incorrectly) assuming they are already non-reusable.

Found by Sergey Kandaurov.

diffstat:

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

diffs (11 lines):

diff -r fc536dcdbbf7 -r 0a5687a458de src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c Thu Feb 11 21:52:12 2021 +0300
+++ b/src/http/v2/ngx_http_v2.c Thu Feb 11 21:52:17 2021 +0300
@@ -326,6 +326,7 @@ ngx_http_v2_init(ngx_event_t *rev)
c->write->handler = ngx_http_v2_write_handler;

c->idle = 1;
+ ngx_reusable_connection(c, 0);

ngx_http_v2_read_handler(rev);
}
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] HTTP/2: fixed reusing connections with active requests.

Maxim Dounin 227 February 11, 2021 02:58PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 242
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready