10

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
100000

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
2708
Malax
  • 223
  • 1
  • 2
  • 5
  • MySQL? There is no MySQL running on that machine. – Malax Nov 06 '12 at 16:55
  • Sorry, my mistake. My fault for posting before I was actually awake. – Zoredache Nov 06 '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 06 '12 at 19:31

3 Answers3

6

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

Clara
  • 61
  • 1
  • 1
5

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

pfo
  • 5,700
  • 24
  • 36
  • Use ulimit -a to get all current limits – FINESEC Nov 06 '12 at 16:34
  • 1
    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 06 '12 at 16:50
0

You can find some per process limits in /etc/systemd/system.conf

user435421
  • 101
  • 1