Welcome! Log In Create A New Profile

Advanced

[nginx] HTTP/2: fixed socket leak with queued frames (ticket #1689).

Maxim Dounin
December 23, 2019 01:36PM
details: https://hg.nginx.org/nginx/rev/82c1339e2637
branches:
changeset: 7610:82c1339e2637
user: Maxim Dounin <mdounin@mdounin.ru>
date: Mon Dec 23 21:25:17 2019 +0300
description:
HTTP/2: fixed socket leak with queued frames (ticket #1689).

If a stream is closed with queued frames, it is possible that no further
write events will occur on the stream, leading to the socket leak.
To fix this, the stream's fake connection read handler is set to
ngx_http_v2_close_stream_handler(), to make sure that finalizing the
connection with ngx_http_v2_finalize_connection() will be able to
close the stream regardless of the current number of queued frames.

Additionally, the stream's fake connection fc->error flag is explicitly
set, so ngx_http_v2_handle_stream() will post a write event when queued
frames are finally sent even if stream flow control window is exhausted.

diffstat:

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

diffs (14 lines):

diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -4288,8 +4288,9 @@ ngx_http_v2_close_stream(ngx_http_v2_str
fc = stream->request->connection;

if (stream->queued) {
+ fc->error = 1;
fc->write->handler = ngx_http_v2_close_stream_handler;
- fc->read->handler = ngx_http_empty_handler;
+ fc->read->handler = ngx_http_v2_close_stream_handler;
return;
}

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] HTTP/2: fixed socket leak with queued frames (ticket #1689).

Maxim Dounin 377 December 23, 2019 01:36PM



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

Online Users

Guests: 307
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