From: Ruslan Ermilov Date: Mon, 23 Sep 2019 12:45:32 +0000 (+0300) Subject: HTTP/2: fixed possible alert about left open socket on shutdown. X-Git-Tag: release-1.17.4~3 X-Git-Url: http://www.kaiwu.me/postgresql/commit/static/gitweb.js?a=commitdiff_plain;h=f878492af35224a4ade84f6f6c15aca2892d3821;p=nginx.git HTTP/2: fixed possible alert about left open socket on shutdown. 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. --- diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c index 640dd4ae7..db95bdd99 100644 --- a/src/http/v2/ngx_http_v2.c +++ b/src/http/v2/ngx_http_v2.c @@ -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; }