Sunday, March 28, 2010

Too Many Open Files problem in Linux

Hi All,

Most of the time during stress testing on linux server, you may encounter the following problem

SEVERE: Endpoint ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=80] ignored exception: java.net.SocketException: Too many open files
java.net.SocketException: Too many open files

We get this error when system reaches the the max file limit set on your Linux OS

first check the limit set on your OS with the following command
cat /proc/sys/fs/file-max

if you want to check the current open files .
1:lsof |wc -l ( to check number of all open files)
2:lsof -p | wc -l ( to check number of opened files by a process)

in Ubuntu
ulimit -n



to change the value
1 edit /etc/sysctl.conf and set fs.file-max to any desired value

then run

sysctl -p

you may have to restart your system after this




No comments:

Post a Comment