Klaus Demo nginx / 5ae7269
HTTP/2: limited number of PRIORITY frames. Fixed excessive CPU usage caused by a peer that continuously shuffles priority of streams. Fix is to limit the number of PRIORITY frames. Ruslan Ermilov a month ago
2 changed file(s) with 11 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
272272 h2scf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_v2_module);
273273
274274 h2c->concurrent_pushes = h2scf->concurrent_pushes;
275 h2c->priority_limit = h2scf->concurrent_streams;
275276
276277 h2c->pool = ngx_create_pool(h2scf->pool_size, h2c->connection->log);
277278 if (h2c->pool == NULL) {
18011802 h2c->state.length);
18021803
18031804 return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_SIZE_ERROR);
1805 }
1806
1807 if (--h2c->priority_limit == 0) {
1808 ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
1809 "client sent too many PRIORITY frames");
1810
1811 return ngx_http_v2_connection_error(h2c, NGX_HTTP_V2_ENHANCE_YOUR_CALM);
18041812 }
18051813
18061814 if (end - pos < NGX_HTTP_V2_PRIORITY_SIZE) {
31183126 } else {
31193127 h2c->processing++;
31203128 }
3129
3130 h2c->priority_limit += h2scf->concurrent_streams;
31213131
31223132 return stream;
31233133 }
121121 ngx_uint_t processing;
122122 ngx_uint_t frames;
123123 ngx_uint_t idle;
124 ngx_uint_t priority_limit;
124125
125126 ngx_uint_t pushing;
126127 ngx_uint_t concurrent_pushes;