"Too many open files" error
I have had this error twice within +/- one month:
> Sep 30 15:16:52 nix dovecot: deliver(
I need to restart dovecot and wait for the mailqueue to empty to make things work again.
Googling this error lead me to think I needed to increase the maximum open files, however, in a standard working situation, I am far from the limit:
# cat /proc/sys/fs/file-nr
1792 0 35041
# lsof -n | wc -l
3742
not sure why these figures are different, but anyhow, far from the 35041 files allowed.
proc(5) also lead me to cat /proc/sys/fs/inode-max but I have no such file on my linode (nor on my workstations).
I have asked to be moved to a newer host quite recently (now on newark157) as I had problems with 2.6.18 kernel and ntp. Not sure if this is related but I had never encountered such issues before.
I have no specific policy defined in /etc/security/limits.conf
Any idea?
Thanks in advance for your help!
Cheers,
Julien
9 Replies
slightly different error message
I'd suspect that there is a ulimit set for the user Dovecot is running as. Note that /etc/security/limits.conf isn't the only place to look, but I'll be damned if I can figure out where the limits are being set on my system (it's not /etc/profile).
Unfortunately, this is not my issue:
dovecot@nix:~$ ulimit
unlimited
I am reluctant to raise the maximum open files for the whole system as I only run a small server for 2 users (smtp/imap/http) hence I doubt I reach the limits set by Linode… even a Linode360.
Any other hints?
Cheers,
Julien
It gives
dovecot@nix$ ulimit -n
1024
It is the same for all other users I have tried.
Not sure where this limit comes from. A default kernel setting?
but again, in a "standard" situation (ie. when everything is working), I am far from this limit:
# lsof -nu dovecot | wc -l
87
One strange thing is that the apache user has 1502 open files, despite the limit set to 1024.
lsof also accounts for network files, which might not be taken into account in these limits.
Cheers,
Julien
As for my main issue, I think (though requires more testing) it was due to a bug in the development version of DSPAM, which left numerous open pipes.
Cheers,
Julien
Search /etc/* for "ulimit"
/etc/security/limits.conf is empty (if I remove the default comments of course).
Nothing intersting in /etc :
# rgrep -i ulimit /etc/
logcheck/ignore.d.server/mldonkey-server:^\w{3} [ :0-9]{11} [._[:alnum:]-]+ mlnet_error: [/[:digit:]]{10} [:[:digit:]]{8} \[cO\] Language [[:upper:]]+, locale [-_.[:alnum:]]+, ulimit for open files [[:digit:]]+$
/etc/login.defs:#ULIMIT
Cheers,
Julien
@JulienV:
www-data (user running apache) also has a limit set to 1024.
Hum… I was not checking on the right server! Sorry for this.
And you are right, www-data has no limits ("unlimited").
Cheers,
Julien