Hello! On Sat, Jun 03, 2017 at 08:04:05PM -0700, Piotr Sikora via nginx-devel wrote:
> # HG changeset patch > # User Piotr Sikora <[email protected]> > # Date 1491296505 25200 > # Tue Apr 04 02:01:45 2017 -0700 > # Node ID bff5ac3da350d8d9225d4204d8aded90fb670f3f > # Parent 716852cce9136d977b81a2d1b8b6f9fbca0dce49 > Upstream: ignore read-readiness if request wasn't sent. > > Signed-off-by: Piotr Sikora <[email protected]> > > diff -r 716852cce913 -r bff5ac3da350 src/http/ngx_http_upstream.c > --- a/src/http/ngx_http_upstream.c > +++ b/src/http/ngx_http_upstream.c > @@ -2179,8 +2179,12 @@ ngx_http_upstream_process_header(ngx_htt > return; > } > > - if (!u->request_sent && ngx_http_upstream_test_connect(c) != NGX_OK) { > - ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR); > + if (!u->request_sent) { > + if (ngx_http_upstream_test_connect(c) != NGX_OK) { > + ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR); > + return; > + } > + > return; > } This change looks wrong, as 1) a response may happen to be received even before we've sent a request - for example, the other side may simply close the connection for its own reasons; 2) in the resulting code we return from a read event handler without calling ngx_handle_read_event(), and this will result in CPU hog when used with level-triggered events. -- Maxim Dounin http://nginx.org/ _______________________________________________ nginx-devel mailing list [email protected] http://mailman.nginx.org/mailman/listinfo/nginx-devel
