How does Java ExitOnOutOfMemoryError flag behaves?
Environment
- Red Hat build of OpenJDK
- 8, 11, 17, 21, 25
- Red Hat Openshift Container Platform
- 4.x
Issue
How does Java ExitOnOutOfMemoryError flag behaves?
Resolution
The flag ExitOnOutOfMemoryError does not exit the JVM immediately before heap dump creation, in case the JVM is instrumented with ..
The user does not need to remove ExitOnOutOfMemoryError from the container runtime for example, because ExitOnOutOfMemoryError does not interfere with creating a heap dump, it just exit it after it is created. But if you have the generate heap, it exit after the heap is created.
Root Cause
The heap dump will be created (if HeapDumpOnOutOfMemoryError if enabled) in the path that is set here: -XX:HeapDumpPath.
For instance, for Data Grid Operator if the HeapDumpOnOutOfMemoryError is set and HeapDumpPath=/opt/infinispan/server/data is set, so then the heap dump will be crated inside the PV, which is the PV is the persisted volume, so it resists the restarts, details Troubleshoot options for Data Grid pod crash.
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.