Bug 1327944

Summary: [GSS](6.4.z) Calling remote asynchronous void method causes OutOfMemoryError in direct buffer memory
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Osamu Nagano <onagano>
Component: EJB, RemotingAssignee: Enrique Gonzalez Martinez <egonzale>
Status: CLOSED CURRENTRELEASE QA Contact: Jan Martiska <jmartisk>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 6.4.6CC: bmaxwell, david.lloyd, egonzale, fgavrilo, jbilek, jtruhlar, myoshida
Target Milestone: CR1   
Target Release: EAP 6.4.10   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1329530 (view as bug list) Environment:
Last Closed: 2017-01-17 13:02:45 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1329530, 1339868, 1344514    
Attachments:
Description Flags
remote-async-void-slsb-dbuffer-leak.zip none

Description Osamu Nagano 2016-04-18 06:07:07 UTC
Created attachment 1148107 [details]
remote-async-void-slsb-dbuffer-leak.zip

Description of problem:
JBoss Remoting enabled direct buffer from 3.3.7.Final, which is included in EAP 6.4.6 (by BZ-1288664/REM3-208).  This causes an OOME in direct buffer when a remote client calls an asynchronous method which has return type void.

~~~
Apr 18, 2016 2:22:26 PM org.xnio.ChannelListeners invokeChannelListener
ERROR: A channel event listener threw an exception
java.lang.OutOfMemoryError: Direct buffer memory
        at java.nio.Bits.reserveMemory(Bits.java:693)
        at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:123)
        at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:311)
        at org.xnio.BufferAllocator$2.allocate(BufferAllocator.java:60)
        at org.xnio.BufferAllocator$2.allocate(BufferAllocator.java:58)
        at org.xnio.ByteBufferSlicePool.allocate(ByteBufferSlicePool.java:86)
        at org.jboss.remoting3.remote.RemoteConnection.allocate(RemoteConnection.java:75)
        at org.jboss.remoting3.remote.RemoteConnectionChannel.allocate(RemoteConnectionChannel.java:581)
        at org.jboss.remoting3.remote.InboundMessage.allocate(InboundMessage.java:190)
        at org.jboss.remoting3.remote.InboundMessage.doSendCloseMessage(InboundMessage.java:104)
        at org.jboss.remoting3.remote.InboundMessage.handleIncoming(InboundMessage.java:243)
        at org.jboss.remoting3.remote.RemoteConnectionChannel.handleMessageData(RemoteConnectionChannel.java:474)
        at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:291)
        at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:46)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
        at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)
        at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
        at org.xnio.nio.NioHandle.run(NioHandle.java:90)
        at org.xnio.nio.WorkerThread.run(WorkerThread.java:198)
~~~


Version-Release number of selected component (if applicable):
EJB client (jboss-client.jar) of EAP 6.4.6


How reproducible:
Always.


Steps to Reproduce:
1. Unzip the reproducer and build an EJB and its client.
~~~
cd remote-async-void-slsb-dbuffer-leak
vi src/test/java/TestMainDBufferLeak.java #The default is against localhost without authentication.
mvn package
~~~
2. Deploy target/remote-async-void-slsb-dbuffer-leak-1.0.0.jar to a standalone server
3. Run the test client
~~~
java -cp $EAP646_HOME/bin/client/jboss-client.jar:target/test-classes:target/remote-async-void-slsb-dbuffer-leak-1.0.0.jar \
     -Xms100m -Xmx100m TestMainDBufferLeak
~~~


Actual results:
"java.lang.OutOfMemoryError: Direct buffer memory" as in the description.


Expected results:
No memory leaks.


Additional info:
Add command line option "-Djboss.remoting.pooled-buffers=false" for the client as a workaround.

Comment 3 Osamu Nagano 2016-04-20 03:31:11 UTC
Created attachment 1148835 [details]
jboss-ejb-client-1.0.32.Final-bz-1327944.jar

Comment 4 Osamu Nagano 2016-04-20 08:55:18 UTC
This is reproducible in WildFly 10.0.0.Final as well.  I created EJBCLIENT-156 and sent a pull request for an engineering review.

Comment 9 JBoss JIRA Server 2016-05-17 10:44:59 UTC
Enrique González Martínez <elguardian> updated the status of jira JBEAP-4284 to Resolved

Comment 10 Jiří Bílek 2016-08-09 12:47:21 UTC
Verified with EAP 6.4.10.CP.CR1

Comment 11 JBoss JIRA Server 2016-08-23 11:38:44 UTC
Jiri Pallich <jpallich> updated the status of jira JBEAP-4284 to Closed

Comment 12 Petr Penicka 2017-01-17 13:02:45 UTC
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.

Comment 13 Petr Penicka 2017-01-17 13:03:08 UTC
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.