How to fix: Too many open files
Chances are you’ve came across this error “Too many open files” on a Linux system. I’ve been getting this for as long as I can remember and now most recently on RHEL 5. This error occurs when a user on a system is unable to open more than a certain number of files at a given time. This means If you’re application is working on 50,000 files simultaneously, you’ll get this error.
To check what your system’s default value is:
$ ulimit -n 1024
To set it to a higher value and make it stick, say 51,200, edit /etc/security/limits.conf and add the following values at the bottom:
user soft nofile 51,200
user hard nofile 51,200
The first field on left hand side is the user that need to open as many as 51,200 files. That’s it.
Terrific work! This is the type of information that should be shared around the web. Shame on the search engines for not positioning this post higher!
Hi,
Many many thanks. Thanks and only thanks. I was struggling last 2 days to solve this problem.
Thanks again.
Binod Suman
Hi ,
This doesn’t work for me.
I am testing android-cts with Froyo.
While testing/running the plan Java , in between the test it throws the error
Cant write to ../../testResult.xml (Too many files open)
Can anyone please help.
Thanks in advance