# HG changeset patch # User Ruslan Ermilov # Date 1429472469 -10800 # Node ID 4a640716f4e2fffdec2fb5c18b5bc3fecb9c6c1a # Parent 36d99c0426527497c745b925fd2aeaac5605a706 Upstream: fixed unlocked access to peer->conns. diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c --- a/src/http/ngx_http_upstream_round_robin.c +++ b/src/http/ngx_http_upstream_round_robin.c @@ -599,17 +599,20 @@ ngx_http_upstream_free_round_robin_peer( peer = rrp->current; + ngx_http_upstream_rr_peers_rlock(rrp->peers); + ngx_http_upstream_rr_peer_lock(rrp->peers, peer); + if (rrp->peers->single) { peer->conns--; + ngx_http_upstream_rr_peer_unlock(rrp->peers, peer); + ngx_http_upstream_rr_peers_unlock(rrp->peers); + pc->tries = 0; return; } - ngx_http_upstream_rr_peers_rlock(rrp->peers); - ngx_http_upstream_rr_peer_lock(rrp->peers, peer); - if (state & NGX_PEER_FAILED) { now = ngx_time();