Uploaded image for project: 'JBoss Remoting (3+)'
  1. JBoss Remoting (3+)
  2. REM3-200

Memory leak in org.xnio.ByteBufferSlicePool

XMLWordPrintable

      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:

      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);
      			}
      		}
      	}
      }
      

      Program produces folowing output:

      сен 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
      

      Used libraries:

      <dependency>
      	<groupId>org.wildfly</groupId>
      	<artifactId>wildfly-controller-client</artifactId>
      	<version>8.1.0.Final</version>
      </dependency>
      

      The same bug is reproduced on other xnio versions: 3.2.3.Final, 3.3.0.Beta2

              dlloyd@redhat.com David Lloyd
              lis0x90@gmail.com Sergey Lisovoy (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              12 Start watching this issue

                Created:
                Updated:
                Resolved: