Wednesday 12 November 2008

java.net.SocketException: Too many open files

We hit this again on sles today, so I thought I should leave a note here for posterity.
java.io.FileNotFoundException: /home/tcmas/tomcat/5.0.28/work/Catalina/localhost/balancer/SESSIONS.ser (Too many open files)

  1. It might be caused by the small amount of memory available! so increasing that, may fix it.
  2. It may also be the the number of open files limit on linux:
Increase file descriptor limit under Linux to prevent java.net.SocketException: Too many open files

Get current limit:

ulimit -n

cat /proc/sys/fs/file-nr

The default limit is 1024.

Get current number of open file descriptors:

lsof [-p pid] | wc -l

Increase the limit:

Edit /etc/security/limits.conf:

username hard nofile 32768

http://hausheer.osola.com/docs/11

2 comments: