Welcome! Log In Create A New Profile

Advanced

Re: [PATCH] HTTP/2: fixed closed_nodes overflow (ticket #1708)

Sergey Kandaurov
February 03, 2022 12:52PM
> On 2 Feb 2022, at 06:26, Maxim Dounin <mdounin@mdounin.ru> wrote:
>
> # HG changeset patch
> # User Maxim Dounin <mdounin@mdounin.ru>
> # Date 1643772371 -10800
> # Wed Feb 02 06:26:11 2022 +0300
> # Node ID 0b272d5fd6bd0dcca6dcca8f27f8fcde33119159
> # Parent dd718d1cef3c2ca2754a21176be3318b00be9e62
> HTTP/2: fixed closed_nodes overflow (ticket #1708).
>
> With large http2_max_concurrent_streams or http2_max_concurrent_pushes, more
> than 255 ngx_http_v2_node_t structures might be allocated, eventually leading
> to h2c->closed_nodes overflow when closing corresponding streams. This will
> in turn result in additional allocations in ngx_http_v2_get_node_by_id().
>
> While mostly harmless, it can result in excessive memory usage by a HTTP/2
> connection, notably in configurations with many keepalive_requests allowed.
> Fix is to use ngx_uint_t for h2c->closed_nodes instead of unsigned:8.
>
> diff --git a/src/http/v2/ngx_http_v2.h b/src/http/v2/ngx_http_v2.h
> --- a/src/http/v2/ngx_http_v2.h
> +++ b/src/http/v2/ngx_http_v2.h
> @@ -153,12 +153,12 @@ struct ngx_http_v2_connection_s {
> ngx_queue_t dependencies;
> ngx_queue_t closed;
>
> + ngx_uint_t closed_nodes;
> ngx_uint_t last_sid;
> ngx_uint_t last_push;
>
> time_t lingering_time;
>
> - unsigned closed_nodes:8;
> unsigned settings_ack:1;
> unsigned table_update:1;
> unsigned blocked:1;
>

Looks good.

A minor point is that now h2c will typically increase by 8 bytes.

--
Sergey Kandaurov

_______________________________________________
nginx-devel mailing list -- nginx-devel@nginx.org
To unsubscribe send an email to nginx-devel-leave@nginx.org
Subject Author Views Posted

[PATCH] HTTP/2: fixed closed_nodes overflow (ticket #1708)

Maxim Dounin 169 February 01, 2022 10:30PM

Re: [PATCH] HTTP/2: fixed closed_nodes overflow (ticket #1708)

Sergey Kandaurov 58 February 03, 2022 12:52PM



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

Online Users

Guests: 97
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready