OutOfMemoryError Direct buffer memory in EAP 6.0.1 HornetQ

Solution Unverified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform 6.0.1
  • Netty 3.2.6.Final

Issue

I'm getting an OutOfMemoryError in EAP 6.0.1 HornetQ

Caused by: java.lang.OutOfMemoryError: Direct buffer memory
     at java.nio.Bits.reserveMemory(Bits.java:658) [rt.jar:1.7.0_71]
     at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:123) [rt.jar:1.7.0_71]
     at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:306) [rt.jar:1.7.0_71]
     at org.jboss.netty.channel.socket.nio.SocketSendBufferPool$Preallocation.<init>(SocketSendBufferPool.java:156)
     at org.jboss.netty.channel.socket.nio.SocketSendBufferPool.<init>(SocketSendBufferPool.java:43)
     at org.jboss.netty.channel.socket.nio.NioWorker.<init>(NioWorker.java:84)
     at org.jboss.netty.channel.socket.nio.NioClientSocketPipelineSink.<init>(NioClientSocketPipelineSink.java:74)
     at org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory.<init>(NioClientSocketChannelFactory.java:135)
     at org.hornetq.core.remoting.impl.netty.NettyConnector.start(NettyConnector.java:310)
     at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnection(ClientSessionFactoryImpl.java:1146)
     at org.hornetq.core.client.impl.ClientSessionFactoryImpl.getConnectionWithRetry(ClientSessionFactoryImpl.java:1002)
     at org.hornetq.core.client.impl.ClientSessionFactoryImpl.connect(ClientSessionFactoryImpl.java:226)
     at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:757)
     at org.hornetq.jms.client.HornetQConnectionFactory.createConnectionInternal(HornetQConnectionFactory.java:601)
     at org.hornetq.jms.client.HornetQConnectionFactory.createXAConnection(HornetQConnectionFactory.java:155)
     at org.hornetq.jms.client.HornetQConnectionFactory.createXAConnection(HornetQConnectionFactory.java:150)
     at org.hornetq.ra.HornetQRAManagedConnection.setup(HornetQRAManagedConnection.java:824)
     at org.hornetq.ra.HornetQRAManagedConnection.<init>(HornetQRAManagedConnection.java:148)
     ... 82 more

Resolution

Upgrade to JBoss EAP 6.1.0 or later.

This issue has been reported and resolved in Netty 3.5.9.Final+.

Root Cause

ByteBuffer is not being cleaned up. See upstream bug report for details: https://github.com/netty/netty/issues/638][(https://github.com/netty/netty/issues/638).


This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.