Skip to content

Commit

Permalink
HTTP/2: fixed the "http request count is zero" alert.
Browse files Browse the repository at this point in the history
When the stream is terminated the HEADERS frame can still wait in the output
queue.  This frame can't be removed and must be sent to the client anyway,
since HTTP/2 uses stateful compression for headers.  So in order to postpone
closing and freeing memory of such stream the special close stream handler
is set to the write event.  After the HEADERS frame is sent the write event
is called and the stream will be finally closed.

Some events like receiving a RST_STREAM can trigger the read handler of such
stream in closing state and cause unexpected processing that can result in
another attempt to finalize the request.  To prevent it the read handler is
now set to ngx_http_empty_handler.

Thanks to Amazon.
  • Loading branch information
VBart committed Jun 16, 2016
1 parent bf5f915 commit 6e38998
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/http/v2/ngx_http_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -3935,6 +3935,7 @@ ngx_http_v2_close_stream(ngx_http_v2_stream_t *stream, ngx_int_t rc)

if (stream->queued) {
fc->write->handler = ngx_http_v2_close_stream_handler;
fc->read->handler = ngx_http_empty_handler;
return;
}

Expand Down

0 comments on commit 6e38998

Please sign in to comment.