Lots of CLOSE_WAIT sockets, nginx+php (WordPress site)

Vicente Aguilar bisente at bisente.com
Fri Feb 26 22:37:09 MSK 2010


> I'll tell you when I find out what the cause of the problem was, just for the sake of having it documented and showing up on Google in case somebody else hits the same issue. :-)

I *think* I might have found what's going on:

On my blog I have some sample scripts for running several servers with daemontools, and some of them are browsable (autoindex on) with the full daemontools directories structure. If you've worked with daemontools you'll know it uses some named pipes (fifos) ... :)

I've tracked several different processes with sockets on CLOSE_WAIT on the debug log and the last line of all of them was accessing one of these fifos. I've tried requesting those files on a freshly restarted nginx and have reproduced the issue: each GET to one of the fifos always produced one or sometimes two CLOSE_WAIT sockets. So in the end it seems it had nothing to do with PHP.

I've removed all the fifos from my site and will keep running nginx 0.6.32 during the weekend. If I have no more issues (I'm pretty confident now I won't), on monday I'll go back to my patched 0.7.65.

Configuring the debug log has been crucial here. Thanks for that tip, Maxim. :)

On a side note: while I agree this was my fault (I should'n have had those "empty" pipes there on the first place), neither Apache nor lighttpd had any problems with this. Or maybe they had but some internal process-cleaning was in place and these stuck processes were being silently killed, I don't know. In any case as I've stated before, I think the problem is not really nginx but the fifos that shouldn't be there.


  Vicente Aguilar <bisente at bisente.com> | http://www.bisente.com

More information about the nginx mailing list