How is it possible I am hitting my limit of 65535 despite netstat saying I have 1000 active connections? Does anyone see a server config issue I might be overlooking or have tips for debugging further?

2 Answers
2

Typing ulimit -n in terminal shows current limit, effective to your current session.
If you've changed limit after compaining daemon start, limits for that daemon was not affected. So you'll need to stop/start daemon. But make sure that limits are not chaning in daemon's init script.

Also, you might want add something like this:

* soft nofile 2048
* hard nofile 2048

to /etc/security/limits.conf, so you don't have to ulimit -n manually each time.

ulimit -n displays the maximum number of open file descriptors, not the maximum number of network connections. You may want to use lsof -p <PID_OF_node.js> to figure out what files it has open. My guess is that your node.js code has some logic flaws.

Actually, opened network socket IS file descriptor as well. So ulimit -n controlls how many local files + network sockets + any other descriptors could be opened by a single process/user.
–
rvsMay 1 '11 at 9:43

1

True. I mentioned open files because we already know at most how many network sockets the process has open; at any rate, lsof will display them all.
–
justarobertMay 1 '11 at 18:06