DirectByteBuffer leak caused by SSL engines not closing in XNIO

Solution Verified - Updated -

Issue

  • The following exception in the JBoss server log:
ERROR [org.jboss.threads.errors] (ServerService Thread Pool -- 22) Thread Thread[ServerService Thread Pool -- 22,5,ServerService ThreadGroup] threw an uncaught exception: java.lang.OutOfMemoryError: Direct buffer memory
        at java.base/java.nio.Bits.reserveMemory(Bits.java:175)
        at java.base/java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:118)
        at java.base/java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:317)
        at java.base/sun.nio.ch.Util.getTemporaryDirectBuffer(Util.java:242)
        at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:242)
        at java.base/sun.nio.ch.IOUtil.read(IOUtil.java:223)
        at java.base/sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:355)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.net.nt.TimeoutSocketChannel.read(TimeoutSocketChannel.java:174)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.net.ns.NSProtocolNIO.doSocketRead(NSProtocolNIO.java:555)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.net.ns.NIOPacket.readHeader(NIOPacket.java:258)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.net.ns.NIOPacket.readPacketFromSocketChannel(NIOPacket.java:190)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.net.ns.NIOPacket.readFromSocketChannel(NIOPacket.java:132)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.net.ns.NIOPacket.readFromSocketChannel(NIOPacket.java:105)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.net.ns.NIONSDataChannel.readDataFromSocketChannel(NIONSDataChannel.java:91)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.jdbc.driver.T4CMAREngineNIO.prepareForUnmarshall(T4CMAREngineNIO.java:764)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.jdbc.driver.T4CMAREngineNIO.unmarshalUB1(T4CMAREngineNIO.java:429)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:407)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:268)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.jdbc.driver.T4C7Ocommoncall.doOLOGOFF(T4C7Ocommoncall.java:64)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.jdbc.driver.T4CConnection.logoff(T4CConnection.java:991)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.jdbc.driver.PhysicalConnection.close(PhysicalConnection.java:2268)
        at com.oracle.ojdbc8@19.3.0.0.0//oracle.jdbc.pool.OraclePooledConnection.close(OraclePooledConnection.java:242)
        at org.jboss.ironjacamar.jdbcadapters@1.4.22.Final-redhat-00001//org.jboss.jca.adapters.jdbc.xa.XAManagedConnection.destroy(XAManagedConnection.java:235)
        at org.jboss.ironjacamar.impl@1.4.22.Final-redhat-00001//org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl.close(XAResourceRecoveryImpl.java:412)
        at org.jboss.ironjacamar.impl@1.4.22.Final-redhat-00001//org.jboss.jca.core.tx.jbossts.XAResourceRecoveryImpl.shutdown(XAResourceRecoveryImpl.java:157)
        at org.jboss.as.connector@7.3.2.GA-redhat-00002//org.jboss.as.connector.subsystems.datasources.XaDataSourceService.stopService(XaDataSourceService.java:62)
        at org.jboss.as.connector@7.3.2.GA-redhat-00002//org.jboss.as.connector.subsystems.datasources.AbstractDataSourceService$1.run(AbstractDataSourceService.java:186)
        at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:1982)
        at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1486)
        at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1377)
        at java.base/java.lang.Thread.run(Thread.java:834)
        at org.jboss.threads@2.3.3.Final-redhat-00001//org.jboss.threads.JBossThread.run(JBossThread.java:485)

Environment

  • JBoss Enterprise Application Platform (EAP) 7.3 Update 2

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In