comparison src/http/v2/ngx_http_v2.c @ 7610:82c1339e2637

HTTP/2: fixed socket leak with queued frames (ticket #1689). If a stream is closed with queued frames, it is possible that no further write events will occur on the stream, leading to the socket leak. To fix this, the stream's fake connection read handler is set to ngx_http_v2_close_stream_handler(), to make sure that finalizing the connection with ngx_http_v2_finalize_connection() will be able to close the stream regardless of the current number of queued frames. Additionally, the stream's fake connection fc->error flag is explicitly set, so ngx_http_v2_handle_stream() will post a write event when queued frames are finally sent even if stream flow control window is exhausted.
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 23 Dec 2019 21:25:17 +0300
parents ab5cac9d3f00
children 8e64e11aaca0
comparison
equal deleted inserted replaced
7609:f609c0ac2972 7610:82c1339e2637
4286 node->id, stream->queued, h2c->processing, h2c->pushing); 4286 node->id, stream->queued, h2c->processing, h2c->pushing);
4287 4287
4288 fc = stream->request->connection; 4288 fc = stream->request->connection;
4289 4289
4290 if (stream->queued) { 4290 if (stream->queued) {
4291 fc->error = 1;
4291 fc->write->handler = ngx_http_v2_close_stream_handler; 4292 fc->write->handler = ngx_http_v2_close_stream_handler;
4292 fc->read->handler = ngx_http_empty_handler; 4293 fc->read->handler = ngx_http_v2_close_stream_handler;
4293 return; 4294 return;
4294 } 4295 }
4295 4296
4296 if (!stream->rst_sent && !h2c->connection->error) { 4297 if (!stream->rst_sent && !h2c->connection->error) {
4297 4298