Please include this fix also in EAP 6.2.2 CP release +++ This bug was initially created as a clone of Bug #1032552 +++ Description of problem: When running testsuite for testing EAP management operations via CLI I am getting OOM. I have created heapdumps, which I have put to nfs-01.eng.brq.redhat.com:/exports/scratch/rhatlapa/heapdump-oom-manyJIoEndpoints*.hprof. The most memory is taken by org.apache.tomcat.util.net.JIoEndpoint$Poller objects which are relatively big (1.5 - 2.0 MB each). It seems, that the HttpProcessor releases the JIoEndpoint objects after some time and the server continues to run. Version-Release number of selected component (if applicable): I have tested it with jbossweb 7.2.2.Final (version in EAP 6.2.0.CR2) and jbossweb 7.3.0.Final How reproducible: Steps to Reproduce: 1. 2. 3. Actual results: OOM exception occurs Expected results: no OOM exception occurs Additional info: --- Additional comment from Radim Hatlapatka on 2013-11-21 13:11:18 EST --- This is error which is shown when the OOM error occurs: 19:04:52,257 ERROR [org.xnio.listener] (Remoting "insignia:MANAGEMENT" read-1) A channel event listener threw an exception: java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) [rt.jar:1.7.0_45] at java.lang.Thread.start(Thread.java:713) [rt.jar:1.7.0_45] at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:949) [rt.jar:1.7.0_45] at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1360) [rt.jar:1.7.0_45] at org.xnio.XnioWorker.execute(XnioWorker.java:577) [xnio-api-3.0.7.GA-redhat-1.jar:3.0.7.GA-redhat-1] at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:218) [jboss-remoting-3.2.18.GA-redhat-1.jar:3.2.18.GA-redhat-1] at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:45) [jboss-remoting-3.2.18.GA-redhat-1.jar:3.2.18.GA-redhat-1] at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72) [xnio-api-3.0.7.GA-redhat-1.jar:3.0.7.GA-redhat-1] at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189) [xnio-api-3.0.7.GA-redhat-1.jar:3.0.7.GA-redhat-1] at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103) [xnio-api-3.0.7.GA-redhat-1.jar:3.0.7.GA-redhat-1] at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72) [xnio-api-3.0.7.GA-redhat-1.jar:3.0.7.GA-redhat-1] at org.xnio.nio.NioHandle.run(NioHandle.java:90) at org.xnio.nio.WorkerThread.run(WorkerThread.java:187) --- Additional comment from Rémy Maucherat on 2013-11-22 04:01:27 EST --- Some connector components use "a lot" of memory, but will last for the lifetime of the connector and are used to keep track of the connections state. The test could be doing a lot of stop/start of the connector, which is allowed but obviously not very common use. The OOM actually occurs in another component (remoting, which uses xnio for its IO). --- Additional comment from Radim Hatlapatka on 2013-11-22 04:29:16 EST --- Yes, that probably will be the case and yes this is definitely not a very common use case. The scenario is that I run lots of management operations via CLI and verify whether the changed configuration was correctly handled by the server (mostly via deployed simple app. Many changes require reload, which is probably the place where the connectors stops/starts are done leading to the OOM. The question is, is it correct behavior of connectors and memory when server reload is done? Or may I somehow influence its behavior to prevent OOM when running many CLI operations => many operations through native interface? --- Additional comment from Radim Hatlapatka on 2013-11-22 07:43:28 EST --- No I've got this OOM error [1], this time it occurred in Web subsystem component. Isn't there option to limit amount of threads used for connectors? [1] ERROR [org.apache.tomcat.util.net] (http-/127.0.0.1:8080-Acceptor-0) JBWEB003011: Error allocating socket processor: java.lang.OutOfMemoryError: unable to create new native thread at java.lang.Thread.start0(Native Method) [rt.jar:1.7.0_45] at java.lang.Thread.start(Thread.java:713) [rt.jar:1.7.0_45] at org.apache.tomcat.util.net.JIoEndpoint$Worker.start(JIoEndpoint.java:940) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.tomcat.util.net.JIoEndpoint.newWorkerThread(JIoEndpoint.java:1162) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.tomcat.util.net.JIoEndpoint.createWorkerThread(JIoEndpoint.java:1141) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.tomcat.util.net.JIoEndpoint.getWorkerThread(JIoEndpoint.java:1173) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.tomcat.util.net.JIoEndpoint.processSocket(JIoEndpoint.java:1211) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at org.apache.tomcat.util.net.JIoEndpoint$Acceptor.run(JIoEndpoint.java:312) [jbossweb-7.2.2.Final-redhat-1.jar:7.2.2.Final-redhat-1] at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_45] --- Additional comment from Rémy Maucherat on 2013-11-27 03:38:52 EST --- I don't think the connector can be immediately GCed right after stopping, as the threads may not all be interrupted etc. So there could be a limit on what you can do here. How long does it take to GC in practice ? --- Additional comment from Radim Hatlapatka on 2013-11-27 12:17:25 EST --- In my case I am getting the OOM after 13 minutes of testing with multiple CLI operations. --- Additional comment from Radim Hatlapatka on 2013-11-28 09:13:03 EST --- This is most likely related to BZ#1035787, I have applied patch proposed by lthon and the OOM no longer occurs. --- Additional comment from Rémy Maucherat on 2013-12-02 06:51:58 EST --- I committed a fix to 7.3 and 7.4. Good catch (it leaks two to three threads per restart of the connector). --- Additional comment from Radim Hatlapatka on 2013-12-19 04:36:16 EST --- --- Additional comment from Rémy Maucherat on 2014-01-10 09:43:10 EST --- It was r2313 in 7.4 and r2315 in 7.3.
Verified in EAP 6.2.2.CR3 CP