# HG changeset patch # User Roman Arutyunyan # Date 1511866800 -10800 # Node ID 1cb92a2d672e57a8ced4a031c095e53d51865103 # Parent 044cb349fd3ccdf0903a2122251979e514dccfa1 Upstream keepalive: clean read delayed flag in stored connections. If a connection with the read delayed flag set was stored in the keepalive cache, and after picking it from the cache a read timer was set on that connection, this timer was considered a delay timer rather than a socket read event timer as expected. The latter timeout is usually much longer than the former, which caused a significant delay in request processing. The issue manifested itself with proxy_limit_rate and upstream keepalive enabled and exists since 973ee2276300 (1.7.7) when proxy_limit_rate was introduced. diff --git a/src/http/modules/ngx_http_upstream_keepalive_module.c b/src/http/modules/ngx_http_upstream_keepalive_module.c --- a/src/http/modules/ngx_http_upstream_keepalive_module.c +++ b/src/http/modules/ngx_http_upstream_keepalive_module.c @@ -340,6 +340,7 @@ ngx_http_upstream_free_keepalive_peer(ng pc->connection = NULL; if (c->read->timer_set) { + c->read->delayed = 0; ngx_del_timer(c->read); } if (c->write->timer_set) {