98: Address already in use

Maxim Dounin mdounin at mdounin.ru
Thu Apr 14 17:58:16 MSD 2011


On Thu, Apr 14, 2011 at 08:04:03AM -0400, slowgary wrote:

> Hi all,
> Nginx has been working fine for months on my server. Recently, however,
> I see that "service nginx configtest" reports the following:
> the configuration file /etc/nginx/nginx.conf syntax is ok
> [emerg]: listen() to, backlog 511 failed (98: Address
> already in use)
> configuration file /etc/nginx/nginx.conf test failed

Could you please provide details about OS you use?

EADDRINUSE should occur on bind() syscall earlier, and it's 
correctly handled there (ignored during configuration testing, and 
no listen() call done).

> I believe nginx has been updated recently, but I'm not sure.  It's
> currently at version 0.8.53.  I've ran configtest before and have never
> seen this error.  I need to add a new site in conf.d, but I fear that
> reloading or restarting afterwards will fail and my live sites will be
> down.

Reload/restart will likely succeed - listen() shouldn't be even 
called in your situation normally.  It's not clear why bind() 
doesn't report the same error though, most likely something 

> netstat -tlnp lists as in use by Program name "nginx.conf"
> (which seems weird, shouldn't this just say "nginx").  Also, if I rename
> the conf.d/site.conf file that includes the 17942 port entry, it just
> fails on the next conf down the line on the following ip/port.
> Now that I've typed out the entire problem, it occurs to me that the
> problem could be the misnamed Program name.  Maybe nginx thinks that a
> different program is occupying those ports because the name is not
> "nginx".  Does that seem likely?  Also, was there a bug fixed somewhere
> that resolved/caused the name change?  I have a hunch that restarting
> nginx will solve the problem, but I don't want to risk it since it's a
> live server.

Name reported by netstat is completely unrelated (and it's not 
under nginx control).

Maxim Dounin

More information about the nginx mailing list