]> git.kaiwu.me - nginx.git/commit
HTTP/2: fixed connection finalization.
authorValentin Bartenev <vbart@nginx.com>
Wed, 29 Mar 2017 17:21:01 +0000 (20:21 +0300)
committerValentin Bartenev <vbart@nginx.com>
Wed, 29 Mar 2017 17:21:01 +0000 (20:21 +0300)
commit0a5e969dd084baf917c21abe07d402b402df0164
treed19340da79aeee388dc7478b1d21d18d0b7cb7a2
parente82559826625d742316a625eebdee203e6506e10
HTTP/2: fixed connection finalization.

All streams in connection must be finalized before the connection
itself can be finalized and all related memory is freed.  That's
not always possible on the current event loop iteration.

Thus when the last stream is finalized, it sets the special read
event handler ngx_http_v2_handle_connection_handler() and posts
the event.

Previously, this handler didn't check the connection state and
could call the regular event handler on a connection that was
already in finalization stage.  In the worst case that could
lead to a segmentation fault, since some data structures aren't
supposed to be used during connection finalization.  Particularly,
the waiting queue can contain already freed streams, so the
WINDOW_UPDATE frame received by that moment could trigger
accessing to these freed streams.

Now, the connection error flag is explicitly checked in
ngx_http_v2_handle_connection_handler().
src/http/v2/ngx_http_v2.c