Skip to main content.

2004-Feb-07

mail:~# grep -i VFS /var/log/messages
Feb  6 01:24:34 mail2 kernel: VFS: file-max limit 4096 reached
Feb  6 13:13:14 mail kernel: VFS: file-max limit 4096 reached
Feb  6 20:07:23 mail kernel: VFS: file-max limit 4096 reached
Feb  7 22:19:19 mail kernel: VFS: file-max limit 4096 reached
Feb  7 22:34:12 mail kernel: VFS: file-max limit 4096 reached
mail:~# lsof | wc -l
9738

To fix:

mail:~# cat /proc/sys/fs/file-max
4096
mail:~# echo 16384 > /proc/sys/fs/file-max
mail:~# cat /proc/sys/fs/inode-max
16384
mail:~# echo 65536 > /proc/sys/fs/inode-max
mail:~# cat /proc/sys/fs/inode-max
65536
mail:~# cat /proc/sys/fs/inode-nr
16400   1531
mail:~# cat /proc/sys/fs/file-nr
4096    3187    16384

Max inodes should be at least three times larger than file max. /proc/sys/fs/inode-nr shows number of inodes allocated and number of free inodes. /proc/sys/fs/file-nr is allocated file handles, free file handles, and max file handles. This is described in proc(5) man page. Also look at http://linuxperf.nl.linux.org/general/kerneltuning.html. (Later I should look at /proc/sys/vm/freepages. And the max number of processes or tasks is defined in /usr/src/linux/include/linux/tasks.h with NR_TASKS -- so need to rebuild kernel as needed.)

mail:~# mailq | wc -l
84857
mail:~# mailq | grep frozen | wc -l
23736
Fix in exim to retry automatically and remove quicker automatically:
# keep on trying to deliver frozen messages every 12 hours
auto_thaw = 12h
#  failing bounce messages are to be discarded after 2 days on the queue
ignore_bounce_errors_after = 2d
# any frozen message is to be discarded after 5 days
timeout_frozen_after = 4d