nginx server over https using up all available file handles

Posted by mmr on Server Fault See other posts from Server Fault or by mmr
Published on 2010-06-07T18:06:31Z Indexed on 2010/06/07 18:12 UTC
Read the original article Hit count: 377

Filed under:
|

Hi all,

So I have an nginx server that's working over https with Sinatra. When I try to download a jnlp file in a configuration that works fine over Mongrel and http (no s), the nginx server fails to serve the file with a 504 error. Subsequent checking of the logs states that this error is due to overflowing the available number of file handles, ie, "24: too many open files". Running

sudo lsof -p <nginx worker pid>

gets me a huge list of files, all looking like:

nginx   1771 nobody   11u     IPv4           10867997         0t0      TCP localhost:44704->localhost:https (ESTABLISHED)
nginx   1771 nobody   12u     IPv4           10868113         0t0      TCP localhost:https->localhost:44704 (ESTABLISHED)
nginx   1771 nobody   13u     IPv4           10868114         0t0      TCP localhost:44705->localhost:https (ESTABLISHED)
nginx   1771 nobody   14u     IPv4           10868191         0t0      TCP localhost:https->localhost:44705 (ESTABLISHED)
nginx   1771 nobody   15u     IPv4           10868192         0t0      TCP localhost:44706->localhost:https (ESTABLISHED)
nginx   1771 nobody   16u     IPv4           10868255         0t0      TCP localhost:https->localhost:44706 (ESTABLISHED)
nginx   1771 nobody   17u     IPv4           10868256         0t0      TCP localhost:44707->localhost:https (ESTABLISHED)
nginx   1771 nobody   18u     IPv4           10868330         0t0      TCP localhost:https->localhost:44707 (ESTABLISHED)
nginx   1771 nobody   19u     IPv4           10868331         0t0      TCP localhost:44708->localhost:https (ESTABLISHED)
nginx   1771 nobody   20u     IPv4           10868434         0t0      TCP localhost:https->localhost:44708 (ESTABLISHED)

Increasing the number of files that can be opened is no help, because then nginx just blows right past that limit. And no wonder, it looks like it's in some kind of loop to pull all available files.

Any idea what's going on, and how to fix it?

© Server Fault or respective owner

Related posts about nginx

Related posts about https