Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error "java.net.SocketException: Too many open files" at deployment phase in jboss-portal-2.7.2

When start the jboss-portal-2.7.2 at some point in the log message:

2013-01-30 20:32:02,541 ERROR [org.apache.tomcat.util.net.JIoEndpoint] Socket accept failed
java.net.SocketException: Too many open files
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:408)
        at java.net.ServerSocket.implAccept(ServerSocket.java:462)
        at java.net.ServerSocket.accept(ServerSocket.java:430)
        at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:61)
        at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:309)
        at java.lang.Thread.run(Thread.java:662)

In the deploy folder a total of 20. war modules. Any solutions?

like image 787
abg Avatar asked Jan 30 '13 15:01

abg


2 Answers

Increase ulimit on your server for the user running tomcat.

To check ulimit:

ulimit -n

To increase for current session:

ulimit -n 102400

You can make permanent changes by editing /etc/security/limits.conf.

like image 93
onlykalu Avatar answered Sep 30 '22 20:09

onlykalu


This message basically implies that you have reached the limit of maximum number of files that you can have open as set by your OS.

The proper way to solve this is by diagnosing the output from lsof -p <jboss_java_pid> and finding out what is contributing to these many files being open. Then proceed accordingly for a solution.

A quick fix solution could be to increase the global maximum file limit on your OS or increase the file limit for the user or both. In Fedora for example this can be set in /proc/sys/file-max file for the global file max limit and /etc/security/limits.conf for user limit.

like image 25
CoolBeans Avatar answered Sep 30 '22 19:09

CoolBeans