Wildfly stops with an error java.lang.OutOfMemoryError: Java heap space around 5 minutes after start.
search cancel

Wildfly stops with an error java.lang.OutOfMemoryError: Java heap space around 5 minutes after start.

book

Article ID: 442208

calendar_today

Updated On:

Products

CA Identity Suite CA Identity Manager

Issue/Introduction

Identity Manager becomes unresponsive shortly after startup.

RAM usage increases rapidly until it reaches the maximum heap size, followed by significant CPU spikes. The WildFly server.log repeatedly shows

java.lang.OutOfMemoryError: Java heap space.

Environment

Identity Manager 14.5.1

Cause

This issue occurs due to an excessive amount of data or orphaned records related to scheduled tasks in the Task Persistence (TP) database, leading to memory exhaustion during task processing.

Resolution

Note: This is an application layer problem, if application support is available then Broadcom recommends discussing this issue with them as they can assist with the heap dump analysis. 

To try to identify why an IDM deployment is experiencing this issue you can use Heap Dumps.

When the system is at a high memory and cpu use, take a java heap dump.
There are multiple ways to collect the heap dump, the simplest would be to use the use the jmap tool which is provided by the JDK/bin folder.

jmap -dump:format=b,file=<file-path> <pid>


The resulting heap dump can be reviewed in a profiler tool like JVisualVM or VisualVM.

In this case we identified and removed unneeded scheduled tasks to stabilize memory usage:

  1. Log in to the Identity Manager Management Console.
  2. Navigate to the Scheduled Tasks section.
  3. Review the list of active and pending tasks.
  4. Delete any unneeded, redundant, or stuck scheduled tasks.
  5. Restart the WildFly server.
  6. Monitor RAM and CPU utilization to ensure stability.


    If memory exhaustion persists after clearing tasks, analyze a Java heap dump to identify other potential memory leaks. Use the following command to capture a dump when memory usage is high: 
jmap -dump:format=b,file=<file-path> <pid>

Additional Information

Additional things worth checking:

If Fine Tuning Garbage Collection is configured.

JMSQueue was cleared.