comparison src/http/ngx_http_upstream.c @ 7906:058a67435e83

Upstream: fixed timeouts with gRPC, SSL and select (ticket #2229). With SSL it is possible that an established connection is ready for reading after the handshake. Further, events might be already disabled in case of level-triggered event methods. If this happens and ngx_http_upstream_send_request() blocks waiting for some data from the upstream, such as flow control in case of gRPC, the connection will time out due to no read events on the upstream connection. Fix is to explicitly check the c->read->ready flag if sending request blocks and post a read event if it is set. Note that while it is possible to modify ngx_ssl_handshake() to keep read events active, this won't completely resolve the issue, since there can be data already received during the SSL handshake (see 573bd30e46b4).
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 20 Aug 2021 03:53:56 +0300
parents 3ab8e1e2f0f7
children 65946a191197 fac88e160653
comparison
equal deleted inserted replaced
7905:13d0c1d26d47 7906:058a67435e83
2111 } 2111 }
2112 2112
2113 c->tcp_nopush = NGX_TCP_NOPUSH_UNSET; 2113 c->tcp_nopush = NGX_TCP_NOPUSH_UNSET;
2114 } 2114 }
2115 2115
2116 if (c->read->ready) {
2117 ngx_post_event(c->read, &ngx_posted_events);
2118 }
2119
2116 return; 2120 return;
2117 } 2121 }
2118 2122
2119 /* rc == NGX_OK */ 2123 /* rc == NGX_OK */
2120 2124