Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My question is pretty simple and is actually stated in the title. One of my applications throws errors regarding "too many open files" at me, even tho the limit for the user the application runs with is higher than the default of 1024 (lsof -u $USER reports 3000 open fds).

Because I cannot imagine why this happens, I guess there might be a maximum per process.

Any idea is very appreciated!

Edit: Some values that might help...

root@Debian-60-squeeze-64-minimal ~ # ulimit -n

root@Debian-60-squeeze-64-minimal ~ # tail -n 4 /etc/security/limits.conf 
myapp  soft nofile 100000
myapp  hard nofile 1000000
root soft nofile 100000
root hard nofile 1000000

root@Debian-60-squeeze-64-minimal ~ # lsof -n -u myapp | wc -l
share|improve this question
MySQL? There is no MySQL running on that machine. – Malax Nov 6 '12 at 16:55
Sorry, my mistake. My fault for posting before I was actually awake. – Zoredache Nov 6 '12 at 18:11
What language is this written in? Also does you app interact with any other apps on the same machine? For example lets say your app opens 1000 socket connections to a DB that is on the same machine that will result in at least an additional 1000 open files system wide. – James Nov 6 '12 at 19:31

Yes, the ulimit facility limits the number of open files and many other things like stack size, core dump size, etc.

share|improve this answer
Use ulimit -a to get all current limits – FINESEC Nov 6 '12 at 16:34
I know about the limits and increased the limit for "open files" because i got "too many open files" errors... But I still get them even tho I do not seem to reach the limit. (4k open/100k max) How does ulimit -a helps me in that regard? Is there another limit that can produce "too many open files" errors? – Malax Nov 6 '12 at 16:50

You can find the limit for a process with pid in /proc/<pid>/limits and there is an entry Max open files.

share|improve this answer

Your Answer


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.