Welcome! Log In Create A New Profile

Advanced

[nginx] HTTP/2: introduced separate handler to retry stream close.

Maxim Dounin
December 23, 2019 01:36PM
details: https://hg.nginx.org/nginx/rev/8e64e11aaca0
branches:
changeset: 7611:8e64e11aaca0
user: Maxim Dounin <mdounin@mdounin.ru>
date: Mon Dec 23 21:25:21 2019 +0300
description:
HTTP/2: introduced separate handler to retry stream close.

When ngx_http_v2_close_stream_handler() is used to retry stream close
after queued frames are sent, client timeouts on the stream can be
logged multiple times and/or in addition to already happened errors.
To resolve this, separate ngx_http_v2_retry_close_stream_handler()
was introduced, which does not try to log timeouts.

diffstat:

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

diffs (45 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
@@ -178,6 +178,7 @@ static void ngx_http_v2_read_client_requ
static ngx_int_t ngx_http_v2_terminate_stream(ngx_http_v2_connection_t *h2c,
ngx_http_v2_stream_t *stream, ngx_uint_t status);
static void ngx_http_v2_close_stream_handler(ngx_event_t *ev);
+static void ngx_http_v2_retry_close_stream_handler(ngx_event_t *ev);
static void ngx_http_v2_handle_connection_handler(ngx_event_t *rev);
static void ngx_http_v2_idle_handler(ngx_event_t *rev);
static void ngx_http_v2_finalize_connection(ngx_http_v2_connection_t *h2c,
@@ -4289,8 +4290,8 @@ ngx_http_v2_close_stream(ngx_http_v2_str

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

@@ -4413,6 +4414,22 @@ ngx_http_v2_close_stream_handler(ngx_eve


static void
+ngx_http_v2_retry_close_stream_handler(ngx_event_t *ev)
+{
+ ngx_connection_t *fc;
+ ngx_http_request_t *r;
+
+ fc = ev->data;
+ r = fc->data;
+
+ ngx_log_debug0(NGX_LOG_DEBUG_HTTP, fc->log, 0,
+ "http2 retry close stream handler");
+
+ ngx_http_v2_close_stream(r->stream, 0);
+}
+
+
+static void
ngx_http_v2_handle_connection_handler(ngx_event_t *rev)
{
ngx_connection_t *c;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] HTTP/2: introduced separate handler to retry stream close.

Maxim Dounin 378 December 23, 2019 01:36PM



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

Online Users

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