Tomcat/JBoss error – Too many files open – HTTP 500

Recently I was looking through my Tomcat logs for an error message wich resulted in a HTTP 500. Looking at the logs, I found this error

SEVERE: Socket accept failed
org.apache.tomcat.jni.Error: Too many open files
at org.apache.tomcat.jni.Socket.accept(Native Method)

This exception indicates that all the available file handles for the process have been used and it cannot allocate new handles to the requesting ones. The way to fix the problem is using this command called ulimit. In our case we would do a

[user@servername ~]$ ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 77824
max locked memory (kbytes, -l) 32
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 10240
cpu time (seconds, -t) unlimited
max user processes (-u) unlimited
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

In our case, we are interested in open files and the way to increase it is by doing the following

[user@servername ~]$ ulimit -n

You will have to restart the process after changing the open files limit.


There are no comments yet...Kick things off by filling out the form below.

Leave a Comment