[
https://issues.jboss.org/browse/WFLY-3834?page=com.atlassian.jira.plugin....
]
David Lloyd commented on WFLY-3834:
-----------------------------------
Since this problem only seems to occur with the remoting management client, my hypothesis
is that a message stream is never being closed, thus its backing buffer is never being
freed. Or maybe management client is doing something that no other protocol is doing
something else no other protocol does, like closing the message before it is fully read or
something like that. Still investigating.
Memory leak in org.xnio.ByteBufferSlicePool
-------------------------------------------
Key: WFLY-3834
URL:
https://issues.jboss.org/browse/WFLY-3834
Project: WildFly
Issue Type: Bug
Components: Domain Management
Affects Versions: 8.1.0.Final
Reporter: Sergey Lisovoy
Assignee: David Lloyd
Labels: memory_leak, memoryleak
I have a simple thread that monitor remote wildfly process status. After some time it
fail with OutOfMemory exception.
I wrote simple exsample how to reproduce its error:
{code:java}
package ru.kamis.tests.xniomemoryleaks;
import org.jboss.as.controller.client.ModelControllerClient;
import org.jboss.as.controller.client.helpers.Operations;
import org.jboss.dmr.ModelNode;
public class OutOfMemoryDemo {
public static void main(String[] args) throws Exception {
for(int i=0; i<1000000; i++) {
ModelControllerClient client = null;
client = ModelControllerClient.Factory.create("localhost", 9990);
ModelNode operation = Operations.createReadAttributeOperation(new
ModelNode().setEmptyList(), "server-state");
client.execute(operation);
client.close();
if(i % 1000 == 0) {
System.out.println("Processed: " + i);
}
}
}
}
{code}
Program produces folowing output:
{noformat}
сен 09, 2014 2:33:20 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.2.2.Final
сен 09, 2014 2:33:20 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.2.2.Final
сен 09, 2014 2:33:20 PM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 4.0.3.Final
Processed: 0
Processed: 1000
Processed: 2000
Processed: 3000
Processed: 4000
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.lang.String.toCharArray(String.java:2746)
at sun.net.www.ParseUtil.encodePath(ParseUtil.java:107)
at sun.misc.URLClassPath$JarLoader.checkResource(URLClassPath.java:757)
at sun.misc.URLClassPath$JarLoader.getResource(URLClassPath.java:842)
at sun.misc.URLClassPath.getResource(URLClassPath.java:199)
at java.net.URLClassLoader$1.run(URLClassLoader.java:358)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at
org.jboss.as.protocol.ProtocolConnectionUtils.connectSync(ProtocolConnectionUtils.java:119)
at
org.jboss.as.protocol.ProtocolConnectionManager$EstablishingConnection.connect(ProtocolConnectionManager.java:256)
at
org.jboss.as.protocol.ProtocolConnectionManager.connect(ProtocolConnectionManager.java:70)
at
org.jboss.as.protocol.mgmt.FutureManagementChannel$Establishing.getChannel(FutureManagementChannel.java:204)
at
org.jboss.as.controller.client.impl.RemotingModelControllerClient.getOrCreateChannel(RemotingModelControllerClient.java:148)
at
org.jboss.as.controller.client.impl.RemotingModelControllerClient$1.getChannel(RemotingModelControllerClient.java:67)
at
org.jboss.as.protocol.mgmt.ManagementChannelHandler.executeRequest(ManagementChannelHandler.java:117)
at
org.jboss.as.protocol.mgmt.ManagementChannelHandler.executeRequest(ManagementChannelHandler.java:92)
at
org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeRequest(AbstractModelControllerClient.java:236)
at
org.jboss.as.controller.client.impl.AbstractModelControllerClient.execute(AbstractModelControllerClient.java:141)
at
org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeForResult(AbstractModelControllerClient.java:127)
at
org.jboss.as.controller.client.impl.AbstractModelControllerClient.execute(AbstractModelControllerClient.java:71)
at ru.kamis.tests.xniomemoryleaks.OutOfMemoryDemo.main(OutOfMemoryDemo.java:15)
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java
heap space
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java
heap space
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java
heap space
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java
heap space
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java
heap space
Exception in thread "RMI TCP Connection(idle)" Exception in thread "RMI
TCP Connection(idle)" java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: Java heap space
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java
heap space
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java
heap space
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java
heap space
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java
heap space
сен 09, 2014 2:35:20 PM org.jboss.as.controller.client.impl.RemotingModelControllerClient
finalize
WARN: JBAS010600: Closing leaked controller client
JBAS010649: Allocation stack trace:
at java.lang.Thread.getStackTrace(Thread.java:1589)
at
org.jboss.as.controller.client.impl.RemotingModelControllerClient.<init>(RemotingModelControllerClient.java:76)
at
org.jboss.as.controller.client.ModelControllerClient$Factory.create(ModelControllerClient.java:353)
at
org.jboss.as.controller.client.ModelControllerClient$Factory.create(ModelControllerClient.java:200)
at ru.kamis.tests.xniomemoryleaks.OutOfMemoryDemo.main(OutOfMemoryDemo.java:12)
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java
heap space
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java
heap space
Exception in thread "RMI TCP Connection(idle)" java.lang.OutOfMemoryError: Java
heap space
{noformat}
Used libraries:
{code:xml}
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-controller-client</artifactId>
<version>8.1.0.Final</version>
</dependency>
{code}
The same bug is reproduced on other xnio versions: 3.2.3.Final, 3.3.0.Beta2
--
This message was sent by Atlassian JIRA
(v6.3.1#6329)