# Ngx upstream round robin bug?

**URL:** <https://www.ruby-forum.com/t/ngx-upstream-round-robin-bug/215145>\
**Category:** NGINX\
**Created:** [December 23, 2011, 10:42am UTC](https://www.ruby-forum.com/t/ngx-upstream-round-robin-bug/215145 "2011-12-23T10:42:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [December 23, 2011, 10:42am UTC](https://www.ruby-forum.com/t/ngx-upstream-round-robin-bug/215145/1 "2011-12-23T10:42:40Z")

</div>

I use nginx as a load balancing for backend web server.  
if this upstream has n servers, and when the number of backend web  
server can’t connect(502 or down) be equal n-1, nginx will response 502  
or 503 status to client.  
I did some test, only in the use of directer like:  
server 10.10.1.2:7003 max\_fails=NUM1 fail\_timeout=NUM2;

within NUM2 second time, send request times \> NUM1, the (NUM1+1)st  
resquest will response 502 or 503. The above will be happened.

nginx version:1.0.11, centos5.4 x86\_64  
this is my conf  
upstream backend {  
server 10.10.1.2:7003 max\_fails=10 fail\_timeout=100; #normal  
service  
server 10.10.1.3:7004 max\_fails=10 fail\_timeout=100; #had down  
server 10.10.1.4:7005 max\_fails=10 fail\_timeout=100; #had down  
}

location / {  
proxy\_pass [http://backend](http://backend);  
}

the access\_log when error happened like:  
1324630768.256 [cas.sdo.com](http://cas.sdo.com)  
/cas/login?gateway=true&service=[http://newkoo.com](http://newkoo.com) 502 10.10.1.4:7005,  
backend 125.64.219.39, 10.129.1.230 0.002, 0.000

Posted at Nginx Forum:

> **[ngx upstream round robin bug?](https://forum.nginx.org/read.php?2,220415,220415#msg-220415)**
>
> I use nginx as a load balancing for backend web server. if this upstream has n servers, and when the number of backend web server can't connect(502 or down) be equal n-1, nginx will response 502 or 503 status to client. I did some test, only in the...

---

<div class="post-metadata">

**Author:** ![defage](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@defage](https://www.ruby-forum.com/u/defage)\
**Post date:** [December 23, 2011, 1:29pm UTC](https://www.ruby-forum.com/t/ngx-upstream-round-robin-bug/215145/2 "2011-12-23T13:29:29Z")

</div>

Hello!

On Fri, Dec 23, 2011 at 04:41:59AM -0500, defage wrote:

> nginx version:1.0.11, centos5.4 x86\_64  
> }
> 
> the access\_log when error happened like:  
> 1324630768.256 [cas.sdo.com](http://cas.sdo.com)  
> /cas/login?gateway=true&service=[http://newkoo.com](http://newkoo.com) 502 10.10.1.4:7005,  
> backend 125.64.219.39, 10.129.1.230 0.002, 0.000

Looks like this one:

> **[\#64 (Nginx discards alive upstreams and returns 502)
          – nginx](https://trac.nginx.org/nginx/ticket/64)**

Maxim D.

---

<div class="post-metadata">

**Author:** ![defage](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/839c29/32.png) [@defage](https://www.ruby-forum.com/u/defage)\
**Post date:** [December 23, 2011, 4:25pm UTC](https://www.ruby-forum.com/t/ngx-upstream-round-robin-bug/215145/3 "2011-12-23T16:25:03Z")

</div>

I got it, thanks your reply.

Posted at Nginx Forum:

> **[Re: ngx upstream round robin bug?](https://forum.nginx.org/read.php?2,220415,220440)**
>
> I use nginx as a load balancing for backend web server. if this upstream has n servers, and when the number of backend web server can't connect(502 or down) be equal n-1, nginx will response 502 or 503 status to client. I did some test, only in the...
