Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

In Ubuntu 9 I am receiving a message on my server that says:

(node) Hit max file limit. Increase "ulimit -n"

However, typing commands in the terminal reveals the following:

$ ulimit       
unlimited
$ ulimit -n      
65535

And a netstat reveals I only have ~1000 connections open.

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?

share|improve this question
1  
Where are you seeing this message ? –  Iain May 1 '11 at 8:31

2 Answers 2

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.

share|improve this answer
    
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. –  rvs May 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. –  justarobert May 1 '11 at 18:06

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.