comparison src/http/v2/ngx_http_v2.h @ 8007:011f5ebdb928

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Thu, 03 Feb 2022 22:46:01 +0300
parents 336084ff943b
children ce6d9cf0f567
comparison
equal deleted inserted replaced
8006:32b0ba4855a6 8007:011f5ebdb928
151 ngx_http_v2_out_frame_t *last_out; 151 ngx_http_v2_out_frame_t *last_out;
152 152
153 ngx_queue_t dependencies; 153 ngx_queue_t dependencies;
154 ngx_queue_t closed; 154 ngx_queue_t closed;
155 155
156 ngx_uint_t closed_nodes;
156 ngx_uint_t last_sid; 157 ngx_uint_t last_sid;
157 ngx_uint_t last_push; 158 ngx_uint_t last_push;
158 159
159 time_t lingering_time; 160 time_t lingering_time;
160 161
161 unsigned closed_nodes:8;
162 unsigned settings_ack:1; 162 unsigned settings_ack:1;
163 unsigned table_update:1; 163 unsigned table_update:1;
164 unsigned blocked:1; 164 unsigned blocked:1;
165 unsigned goaway:1; 165 unsigned goaway:1;
166 unsigned push_disabled:1; 166 unsigned push_disabled:1;