How to handle java.net.SocketException: Too many open files
12,578
Solution 1
I guess you are on a linux based operating system? It's seems that you need to increase the number of max. file handles per process.
have a look here: http://ehaselwanter.com/en/blog/2009/03/13/tomcat-too-many-open-files/
Solution 2
It Exceeded the number of open file descripted limits. Solution : Increase the Hard and soft limits on number of open files.
soft nofile 999999 hard nofile 999999 In /etc/security/limits.conf file
Author by
Sangram Anand
Updated on June 04, 2022Comments
-
Sangram Anand about 2 years
Ours is a Struts2 java webapplication, using hibernate 3.5 ORM. When we perfom some parallel actions on the app, we are getting the below exceptions and the java process cpu utilization is at its max.
May 15, 2012 12:39:59 AM org.apache.catalina.core.ApplicationDispatcher invoke SEVERE: Servlet.service() for servlet jsp threw exception 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:59) at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:210) at java.lang.Thread.run(Thread.java:662)
Please suggest us accordingly.