bug in listen in 0.6.{32,35}?

Igor Sysoev is at rambler-co.ru
Wed Apr 15 22:38:48 MSD 2009


On Wed, Apr 15, 2009 at 12:53:57PM -0400, mikew wrote:

> Hey All,
> 
> We're extremely happily using nginx 0.5.blah for much hosting.
> 0.5.x isn't broke, so we have no plans to "fix" it in the forseable future. However, we have a good use for gzip_static, so have to move to 0.6.x for some servers.
> 
> I'm having trouble converting our config style from 0.5.x to 0.6.x, "listen" isn't working how it used to, or how the documentation says it should.
> Each server has it's own IP address, and a series of extra IP addresses for serving content. To save serious headaches we need to use the same config on multiple machines, in different data centres.
> Previously a config like this worked as expected:
> 
> server {
> listen *:80 default bind;
> server_name hostname1.dc1.blah hostname2.dc1.blah hostname.dc2.blah
> }
> server {
> listen 192.168.36.20:80;
> listen 192.168.136.20:80;
> server_name www.blah.com;
> }
> server {
> listen 192.168.36.20:80;
> listen 192.168.136.20:80;
> server_name www.foo.com;
> }
> 
> nginx would bind to *:80 and not complain that it doesn't have any of the other IPs.
> With nginx 0.6.35 (and 0.6.32) that configuration fails the test, and logs this:
> 
> 2009/04/15 17:12:19  4767#0: bind() to 192.168.36.80:80 failed (99: Cannot assign requested address)
> 
> If I take out listen directives for IPs this machine does not have, the config test passes, but it still won't start, with logs like this:
> 
> 2009/04/15 17:02:20  4702#0: bind() to 127.0.0.1:80 failed (98: Address already in use)
> 2009/04/15 17:02:20  4702#0: bind() to 192.168.136.80:80 failed (98: Address already in use)
> 2009/04/15 17:02:20  4702#0: try again to bind() after 500ms
> 2009/04/15 17:02:20  4702#0: bind() to 127.0.0.1:80 failed (98: Address already in use)
> 2009/04/15 17:02:20  4702#0: bind() to 192.168.136.80:80 failed (98: Address already in use)
> 2009/04/15 17:02:20  4702#0: try again to bind() after 500ms
> 2009/04/15 17:02:20  4702#0: still could not bind()
> 
> 
> Am I missing something, or should this not have worked before (in which case, what should I be doing?), or have I found a bug?

I can not reproduce these errors on 0.6.36 with above configuration:
in my test nginx binds to the *:80 only.


-- 
Igor Sysoev
http://sysoev.ru/en/





More information about the nginx mailing list