Why is Java VM not recovering from "Too many open files" errors?

In some well-understood circumstances, our application will open too many sockets (database connections) and reach the maximum open files that the OS allows. We understand that; we fix the problem and also face the limit.

What we cannot explain is why the parts of our application are not restored even after the number of connections is reduced and we are within the limit.

In this case, this is an application running under Tomcat.

When this happens, we will first begin to see "Too many open files" errors:

SEVERE: Socket accept failed
java.net.SocketException: Too many open files
        at java.net.PlainSocketImpl.socketAccept(Native Method)
        at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:390)
        at java.net.ServerSocket.implAccept(ServerSocket.java:453)
        at java.net.ServerSocket.accept(ServerSocket.java:421)
        at org.apache.tomcat.util.net.DefaultServerSocketFactory.acceptSocket(DefaultServerSocketFactory.java:61)
        at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:310)
        at java.lang.Thread.run(Thread.java:619)

In the end, we start to see NoClassDefFoundErrorinside the application stream that is trying to open HTTP connections:

java.lang.NoClassDefFoundError: org/apache/commons/httpclient/protocol/ControllerThreadSocketFactory
        at org.apache.commons.httpclient.protocol.DefaultProtocolSocketFactory.createSocket(DefaultProtocolSocketFactory.java:128)
        at org.apache.commons.httpclient.HttpConnection.open(HttpConnection.java:707)
        at org.apache.commons.httpclient.MultiThreadedHttpConnectionManager$HttpConnectionAdapter.open(MultiThreadedHttpConnectionManager.java:1349)
       [...]
Caused by: java.lang.ClassNotFoundException: org.apache.commons.httpclient.protocol.ControllerThreadSocketFactory
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1387)
        at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1233)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
        ... 8 more

, , , , stderr.

stdout, , " " .

, JVM Hotspot , " " , , .

:. Stephen C , , , . , . Sun? , , ?

:

Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) 64-Bit Server VM (build 14.0-b16, mixed mode)

Apache Tomcat Version 6.0.18
+5
2

, , ClassNotFoundExceptions, , ControllerThreadSocketFactory - Socket. , , .

, . JVM .

+1

, Weblogic 8.1/JRockIt R27.2 webapps, , - . (.. ) .

0

All Articles