Bug 1223708 - Out of memory: Direct Buffer Memory
Summary: Out of memory: Direct Buffer Memory
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Web
Version: 6.4.1
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: CR1
: EAP 6.4.3
Assignee: baranowb
QA Contact: Jan Stefl
URL:
Whiteboard:
Depends On:
Blocks: 1221875 1231259
TreeView+ depends on / blocked
 
Reported: 2015-05-21 09:50 UTC by Jan Stefl
Modified: 2017-01-17 10:38 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2017-01-17 10:38:09 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Direct memory report (18.32 KB, text/plain)
2015-05-21 09:50 UTC, Jan Stefl
no flags Details
server.log (2.35 KB, text/plain)
2015-05-21 09:50 UTC, Jan Stefl
no flags Details
server.log (479.42 KB, application/octet-stream)
2015-05-21 09:52 UTC, Jan Stefl
no flags Details
exception.txt (2.35 KB, text/plain)
2015-05-21 09:52 UTC, Jan Stefl
no flags Details
standalone-ha.xml (21.34 KB, application/xml)
2015-05-21 09:56 UTC, Jan Stefl
no flags Details

Description Jan Stefl 2015-05-21 09:50:06 UTC
Created attachment 1028055 [details]
Direct memory report

Problem: "java.lang.OutOfMemoryError: Direct buffer memory" was thrown during connector performance testing, see attaches 'exception.txt'.

The problem was hidden by [1] which was fixed in 6.4.1.CP.CR2, therefore this is not a regression.

Performance connectors testing
 * EAP is started with configuration standalone-ha.xml (see attachment)
   * please notice http connectors especialy, nio2 is set
 * EAP is requested from 4 other nodes by commands like (request are no-keep alive)
   ab -n 10000 -c 256 -Z ECDHE-RSA-DES-CBC3-SHA <https://...>
   This command is executed ~ 60 times from each node.

 * Exception was thrown after ~ 50minutes in described scenario 
 * I tried to increate direct buffer memory to 8G ( -XX:MaxDirectMemorySize=8G) and exception was thrown later only (after ~ 150 minutes).
 * I monitored direct buffer memory during scenario with increased memory by [2]. For details see attached 'direct-buffer-memory-monitor.log' and 'server.log'.


[1] https://bugzilla.redhat.com/show_bug.cgi?id=1200276
[2] https://blogs.oracle.com/alanb/resource/MonBuffers.java
[3] EAP JAVA_OPTS
      -XX:+UseCompressedOops 
      -verbose:gc 
      -Xloggc:"/tmp/hudson/jboss-eap/standalone/log/gc.log" 
      -XX:+PrintGCDetails 
      -XX:+PrintGCDateStamps 
      -XX:+UseGCLogFileRotation 
      -XX:NumberOfGCLogFiles=5 
      -XX:GCLogFileSize=3M 
      -XX:-TraceClassUnloading 
      -server -Xms5g -Xmx5g -XX:MaxPermSize=512m -Xss1024k 
      -Dorg.jboss.resolver.warning=true  
      -Dsun.rmi.dgc.client.gcInterval=3600000 
      -Dsun.rmi.dgc.server.gcInterval=3600000 
      -Djgroups.udp.ip_ttl=1 
      -Djava.net.preferIPv4Stack=true 
      -Djboss.modules.system.pkgs=org.jboss.byteman 
      -Dsf.pid=WvphqJBs824awiZM

Comment 1 Jan Stefl 2015-05-21 09:50:43 UTC
Created attachment 1028056 [details]
server.log

Comment 2 Jan Stefl 2015-05-21 09:52:02 UTC
Created attachment 1028057 [details]
server.log

Comment 3 Jan Stefl 2015-05-21 09:52:55 UTC
Created attachment 1028058 [details]
exception.txt

Comment 4 Jan Stefl 2015-05-21 09:56:15 UTC
Created attachment 1028061 [details]
standalone-ha.xml

Comment 5 Carlo de Wolf 2015-05-21 10:38:38 UTC
From direct-buffer-memory-monitor.log these appear to be the results of GC:
09:54:01 PM	49720	561833612	561833612
11:09:01 PM	14595	178052887	178052887
12:28:01 AM	17866	216067099	216067099
01:48:01 AM	17717	211701469	211701469
03:07:01 AM	13474	170090946	170090946
04:23:01 AM	17971	219654123	219654123

I see no problem there.

Comment 6 Rémy Maucherat 2015-05-21 11:10:41 UTC
Here, the SecureNioChannel does not need to use direct buffers, so it would be good to change that to regular ones and use that to determine there's a leak [I doubt it]. It looks like the JVM would have a much harder time GCing those direct buffers.

Example of the problem:
http://stackoverflow.com/questions/1854398/how-to-garbage-collect-a-direct-buffer-java

Comment 9 Jan Stefl 2015-06-03 10:00:31 UTC
> x60 times? does this mean 4x60x256 concurrent calls or 4x256 concurrent calls and 60 repetitions.
4x256 concurrent calls and 60 repetitions.

> Jan can you share JDK/OS pair?
Oracle JDK7 / RHEL7

> So can you hack a bit SecureNioChannel and replace all ByteBuffer.allocateDirect ...
If anyone provide patch to me I will execute the test over it. 
Testing time depends on load in lab.

Comment 12 Jan Stefl 2015-06-22 06:17:00 UTC
I did testing with provided patch and exception did not appear anymore.

I didn't notice performance drop - result of patched and not patched server are same basically.

Comment 13 Rémy Maucherat 2015-06-22 09:52:10 UTC
r2617 in web.

Comment 14 baranowb 2015-06-22 10:39:50 UTC
great, thanks Remy.

Comment 16 Jan Stefl 2015-07-31 07:40:08 UTC
Verified in 6.4.3.CR1.
PASSED.

Thank you.

Comment 17 Petr Penicka 2017-01-17 10:38:09 UTC
Retroactively bulk-closing issues from released EAP 6.4 cummulative patches.


Note You need to log in before you can comment on or make changes to this bug.