DirectByteBuffer native memory leak caused by remoting issue in JBoss EAP 7.2

Solution Unverified - Updated

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 7.2
  • OpenJDK/Oracle JDK

Issue

The java.lang.OutOfMemoryError: Direct buffer memory happened in the application when the remote EJB calls is done.

Resolution

Apply JBoss Enterprise Application Platform (EAP) 7.2 Update 8 or later when available to resolve the issue.

Root Cause

This content is not included.JBEAP-18587 - EJB client behaviour is different when deployed in a .war compared to a .ear and can result in a OOME caused by This content is not included.REM3-352 - ConnectionInfo.NoShared does not update state when new connection is created.

Diagnostic Steps

Check the heap to see if the sum of the java.nio.DirectByteBuffer capacities in the Cleaner queue equals the -XX:MaxDirectMemorySize=N setting.

  • SELECT c.capacity FROM OBJECTS ( SELECT OBJECTS referent FROM INSTANCEOF sun.misc.Cleaner ) c WHERE (c.capacity != null)
  • Export as txt file
  • Open in LibreOffice and sum

Check the heap to see if there are a large number of java.nio.DirectByteBuffer objects, with the sum of the capacities as large or larger than the physical memory of the box.

  • SELECT d.capacity FROM java.nio.DirectByteBuffer d
  • Export as txt file
  • Open in LibreOffice and sum
Components

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.