Skip to content

Commit

Permalink
HTTP/2: fixed possible alert about left open socket on shutdown.
Browse files Browse the repository at this point in the history
This could happen when graceful shutdown configured by worker_shutdown_timeout
times out and is then followed by another timeout such as proxy_read_timeout.
In this case, the HEADERS frame is added to the output queue, but attempt to
send it fails (due to c->error forcibly set during graceful shutdown timeout).
This triggers request finalization which attempts to close the stream.  But the
stream cannot be closed because there is a frame in the output queue, and the
connection cannot be finalized.  This leaves the connection open without any
timer events leading to alert.

The fix is to post write event when sending output queue fails on c->error.
That will finalize the connection.
  • Loading branch information
mdocguard committed Sep 23, 2019
1 parent af0e284 commit f878492
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/http/v2/ngx_http_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,12 @@ ngx_http_v2_send_output_queue(ngx_http_v2_connection_t *h2c)
ngx_http_core_loc_conf_t *clcf;

c = h2c->connection;
wev = c->write;

if (c->error) {
return NGX_ERROR;
goto error;
}

wev = c->write;

if (!wev->ready) {
return NGX_AGAIN;
}
Expand Down

0 comments on commit f878492

Please sign in to comment.