Too many open files

When the "Too Many Open Files" error message is written to the logs, it indicates that all available file handles for the process have been used (this includes sockets as well).

In a majority of cases, this is the result of file handles being leaked by some part of the application. ulimit is a command in Unix/Linux which allows to set system limits for all properties. In your case, you need to increase the maximum number of open files to a large number (e.g. 1000000):

ulimit -n 1000000

or

sysctl -w fs.file-max=1000000

and /etc/security/limits.conf or /etc/sysctl.conf change:

fs.file-max = 1000000

To determine if the number of open files is growing over a period of time, issue lsof to report the open files against a PID on a periodic basis. For example:

lsof -p [PID] -r [interval in seconds, 1800 for 30 minutes] > lsof.out

This is especially useful if you don't have access to the lsof command:

ls -al /proc/PID/fd

Guidelines for setting ulimits