Welcome! Log In Create A New Profile

Advanced

[nginx] HTTP/2: improved handling of "keepalive_timeout 0".

Maxim Dounin
March 25, 2021 06:46PM
details: https://hg.nginx.org/nginx/rev/ade8160120c1
branches:
changeset: 7805:ade8160120c1
user: Maxim Dounin <mdounin@mdounin.ru>
date: Fri Mar 26 01:44:57 2021 +0300
description:
HTTP/2: improved handling of "keepalive_timeout 0".

Without explicit handling, a zero timer was actually added, leading to
multiple unneeded syscalls. Further, sending GOAWAY frame early might
be beneficial for clients.

Reported by Sergey Kandaurov.

diffstat:

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

diffs (14 lines):

diff -r 4a9d28f8f39e -r ade8160120c1 src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c Wed Mar 24 14:03:33 2021 +0300
+++ b/src/http/v2/ngx_http_v2.c Fri Mar 26 01:44:57 2021 +0300
@@ -1368,7 +1368,9 @@ ngx_http_v2_state_headers(ngx_http_v2_co
clcf = ngx_http_get_module_loc_conf(h2c->http_connection->conf_ctx,
ngx_http_core_module);

- if (h2c->connection->requests >= clcf->keepalive_requests) {
+ if (clcf->keepalive_timeout == 0
+ || h2c->connection->requests >= clcf->keepalive_requests)
+ {
h2c->goaway = 1;

if (ngx_http_v2_send_goaway(h2c, NGX_HTTP_V2_NO_ERROR) == NGX_ERROR) {
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] HTTP/2: improved handling of "keepalive_timeout 0".

Maxim Dounin 341 March 25, 2021 06:46PM



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

Online Users

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