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.

Let me get all of the ulimit -n and /etc/security/limits.conf answers out of the way by saying this: I've tried setting ulimit -n to 2048, 4096, and 65535. I have set both the soft and hard limit for nofiles to all of those values. ulimit -n shows that it has been changed. But when running the server, it can still only have 1024 open sockets. accept is failing with errno 24 (too many open connections.)

After hours of googling, asking in #debian, and reading questions on ServerFault, I have still not found a solution. Why would ulimit -n show one number, but still be restricted to 1024 open file descriptors?

Some potentially useful information: The process is being started at the terminal in a screen, in su. Yes, I have added pam_limits.so to /etc/pam.d/su. I also added it to /etc/pam.d/common-session. Still no luck.

share|improve this question

2 Answers 2

What does this command tell you?

sysctl fs.file-max

You might try:

sysctl -w fs.file-max=[bigger-number]

If that works, then add this to your /etc/sysctl.conf file:

fs.file-max = [bigger-number]
share|improve this answer
1  
Sorry, no go. :( fs.file-max = 333605 –  Ramsey Sep 20 '09 at 2:33

Nevermind, it turns out the problem was a combination of ulimit -n and FD_SETSIZE. It seems like the application is using setrlimit to set ulimit -n to FD_SETSIZE. I fixed this by undefining and redifining __FD_SETSIZE to something larger.

share|improve this answer
    
Are you able to elaborate on this a bit please? –  UpTheCreek Jun 9 at 11:48

Your Answer

 
discard

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