KB Article #101749

Error message "Too many open files" in the ST logs

Problem

What does the "Too many open files" message in the ST's logs mean and how to resolve it?


Background

The "Too many open files" message means that the operating system has reached the maximum "open files" limit and will not allow SecureTransport, or any other running applications to open any more files.


The open file limit can be viewed with the ulimit command:


  • The ulimit -aS command displays the current limit.
  • The ulimit -aH command displays the hard limit above which the limit cannot be increased without tuning the kernel parameters in the /proc directory.


The following is an example of the output of ulimit -aH. You can see that the current shell (and its children) is restricted to 8000 open file descriptors.


# ulimit -aH
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31620
max locked memory       (kbytes, -l) 256
max memory size         (kbytes, -m) unlimited
open files                      (-n) 8000
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31620
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited


Solution

You can increase the file descriptor limit in the following way:


Edit the /etc/security/limits.conf file and change the following lines:


soft    nofile  8000
hard    nofile  8000


to become:


soft    nofile  65535
hard    nofile  65535


Notes

  • The limits will be applied after the current SSH session to the server's console is restarted (log out and log in again)
  • The ST services must be restarted to load and use the new limits


After the changes (and the restart of the SSH sesssion as noted above), the output of ulimit -aH should look like this:


# ulimit -aH
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 31620
max locked memory       (kbytes, -l) 256
max memory size         (kbytes, -m) unlimited
open files                      (-n) 65535
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) unlimited
cpu time               (seconds, -t) unlimited
max user processes              (-u) 31620
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited