Nginx discards alive upstreams and returns 502
|Reported by:||Vladimir Protasov||Owned by:||somebody|
|Keywords:||upstream, proxy, load balancing||Cc:|
|uname -a:||Linux tst-hostname 2.6.32-21-generic-pae #32-Ubuntu SMP Fri Apr 16 09:39:35 UTC 2010 i686 GNU/Linux|
nginx: nginx version: nginx/1.0.10
nginx: built by gcc 4.4.3 (Ubuntu 4.4.3-4ubuntu5)
nginx: configure arguments: --prefix=/usr/local/nginx --with-debug
We've set up Nginx as load balancer, but sometimes it returns 502 instead of page contents.
We've found the problem is happening when some of backends is going down for maintenance (while others is alive and looks good).
Looks like Nginx sometimes decides that alive servers is down, while they aren't.
Everything is tested under very low load (32 requests was performed from a single client in a few threads).
The problem is easily reproducible and affects all Nginx versions since 0.9.4 up to 1.1.9. It's harder to reproduce it in 0.8.55, but looks like it's affected too.
I'm attaching sample minimized configuration with debug logs for latest stable version, which should help to reproduce and figure out the problem.
Also, the problem was reproduced on Centos 6.0 with backends running apache, Nginx and IIS on both Windows and Linux (whenever it was possible).