Http2 idle connection and worker shutdown

Jojy Varghese jojy_varghese at apple.com
Thu Oct 20 17:51:06 UTC 2022


Hi
  We noticed that the Http2 idle flag (https://github.com/nginx/nginx/blob/master/src/http/v2/ngx_http_v2.h#L126) is initialized to `1` (https://github.com/nginx/nginx/blob/master/src/http/v2/ngx_http_v2.c#L335) but not reset by  the http2 state machine. It also looks like Nginx does not set keep alive timer for http2 as the keep alive setter code path is short circuited for http2 (https://github.com/nginx/nginx/blob/master/src/http/ngx_http_request.c#L2706). 

  During worker shutdown when idle connections are reaped (https://github.com/nginx/nginx/blob/master/src/core/ngx_connection.c#L1363), due to the fact that http2 connections are always `idle`,  ongoing streams end up prematurely getting closed on the read side(sends GOAWAY frame). 

It looks like the `idle` connection implementation as it is today only answers the question - “Can nginx prematurely close the streams when shutting down?”   Is the above behavior intentional? 

It appears from the name of the flag (`idle`) that the intent is to reflect the dynamic state of the connection (are reads and writes happening for the connection for any of the streams) but the implementation does not reflect that.

What is the intended behavior ? We would have liked a `idle` flag with its corresponding timeout configuration that lets us control the behavior during shutdown (and other flows).


Thanks in advance

Jojy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20221020/c7d76d1d/attachment.htm>


More information about the nginx-devel mailing list