[PATCH] HTTP/2: fixed premature connection closure during reload (ticket #626).

Valentin V. Bartenev vbart at nginx.com
Thu Dec 17 13:39:40 UTC 2015


On Wednesday 02 December 2015 18:40:03 Wai Keen Woon wrote:
> # HG changeset patch
> # User Wai Keen Woon <waikeen.woon at onapp.com>
> # Date 1449052722 -28800
> #      Wed Dec 02 18:38:42 2015 +0800
> # Node ID 4b7ef34610ebe00eb6a6d52008a48f9864dadd33
> # Parent  be3aed17689c0edd36c2025ff5c36fe493b68bd7
> HTTP/2: fixed premature connection closure during reload (ticket #626).
> 
> HTTP/2 transfers may be closed prematurely during nginx reload, which logs
> "open socket #X left in connection Y" alerts.
> 
> ngx_add_timer() isn't called when frames are sent faster than they can be
> created. The worker process therefore exits because there are no more timers
> scheduled, even though there are more data frames and finalization
> forthcoming.
> 
> diff -r be3aed17689c -r 4b7ef34610eb src/http/v2/ngx_http_v2.c
> --- a/src/http/v2/ngx_http_v2.c    Wed Dec 02 01:06:54 2015 +0300
> +++ b/src/http/v2/ngx_http_v2.c    Wed Dec 02 18:38:42 2015 +0800
> @@ -535,7 +535,7 @@
>           c->tcp_nodelay = NGX_TCP_NODELAY_SET;
>       }
> 
> -    if (cl) {
> +    if (cl || h2c->processing) {
>           ngx_add_timer(wev, clcf->send_timeout);
> 
>       } else {
> 
[..]

This is completely wrong approach to solve the issue.  For example, with
your patch the send timeout will be triggered in cases while nginx is
waiting for backend, or delaying request with limit_req, or resolving
an address.

Please try the attached patch instead.

  wbr, Valentin V. Bartenev
-------------- next part --------------
A non-text attachment was scrubbed...
Name: timeouts.patch
Type: text/x-patch
Size: 17208 bytes
Desc: not available
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20151217/2a98aa9b/attachment.bin>


More information about the nginx-devel mailing list