comparison src/http/v2/ngx_http_v2.c @ 7570:d6cf51af8a3d

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.
author Ruslan Ermilov <ru@nginx.com>
date Mon, 23 Sep 2019 15:45:32 +0300
parents 80359395b345
children ab5cac9d3f00
comparison
equal deleted inserted replaced
7569:80359395b345 7570:d6cf51af8a3d
511 ngx_connection_t *c; 511 ngx_connection_t *c;
512 ngx_http_v2_out_frame_t *out, *frame, *fn; 512 ngx_http_v2_out_frame_t *out, *frame, *fn;
513 ngx_http_core_loc_conf_t *clcf; 513 ngx_http_core_loc_conf_t *clcf;
514 514
515 c = h2c->connection; 515 c = h2c->connection;
516 wev = c->write;
516 517
517 if (c->error) { 518 if (c->error) {
518 return NGX_ERROR; 519 goto error;
519 } 520 }
520
521 wev = c->write;
522 521
523 if (!wev->ready) { 522 if (!wev->ready) {
524 return NGX_AGAIN; 523 return NGX_AGAIN;
525 } 524 }
526 525