Too many open files
Submitted by DenRaf on Thu, 02/26/2009 - 19:02
Has anyone a clue on this one ?
sudo cat /proc/sys/fs/file-max
1048576
sudo cat /etc/security/limits.conf
* soft nofile 1048576
* hard nofile 1048576
sudo cat /etc/sysctl.conf
fs.file-max=1048576
ulimit -n
1048576
But yet when my service starts at boot:
sudo cat /proc/pid/limits | grep files
Max open files 1024 1024 files
Whenever I restart my service everything is ok:
sudo cat /proc/pid/limits | grep files
Max open files 1048576 1048576 files
This is running on a Debian Etch with kernel 2.6.28



4 reponses to "Too many open files"
1. is it not part of your profile?
in rhel 5 i noticed they also have an entry like that in /etc/profile or ~/.profile or the likes (should have a look at work in my documentation which exactly overrides it ...) to fix this i just commented that line and problem solved!
Not sure if it's also the case in debian, but anyway tweaking the amount of open files to such a high amount suggests you are doing strange stuff (it is not recommended!)
2. No profile files. I know it's
No profile files.
I know it's a high value, but we are doing strange stuff and it was requested by the customer.
I have temporarily fixed it by calling ulimit in the init script and that works fine.
3. Second attempt
O.K., I've read the thread again and seen that half of my previous reply is unnecessary. However, that /etc/initscript may be the key.
4. Two types of max. number of file descriptors
Hi,
To be able to have 100 000 files open systemwide is not so strange...
There are two types of limit of the max. number of file descriptors: system-wide and login shell-wide. The system-wide can be checked this way:
cat /proc/sys/fs/file-max
The default value is 205290 on many distros.
The other limit is per user and per login shell and is set in /etc/security/limits.conf in CentOS and openSUSE. The default value for that is 1024. This means when you log in and run 'ulimit -n' from your shell it shows 1024. There is a way to set it higher:
/etc/iniscript:
ulimit -n 4096
eval exec "$4"
/etc/security/limits.conf
* soft nofile 1024
* hard nofile 1024
root soft nofile 4096
root hard nofile 8192
user1 soft nofile 4096
user1 hard nofile 8192
Here is a reference:
http://publib.boulder.ibm.com/infocenter/dmndhelp/v6rxmx/index.jsp?topic...
and another one:
http://confluence.atlassian.com/display/CONF26/Fix+%27Too+many+open+file...
HTH