I am trying to analyze an application that again and again dies with a heap out-of-memory.
The application is started with:
export JAVA_OPTS="-Xms256M -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/our_app_here/heapdump.dmp"
Before the application dies completely I see multiple entries like this in the log:
2021-01-11 07:17:05,039 [ERROR] [User=xxxxx] [class-name-here] Exception occured: java.lang.OutOfMemoryError: Java heap space
These errors happen in a try-catch where they are obviously caught and logged. Amazingly the application continues but - not too surprisingly - crashes shortly after.
Why does the JVM not write any heap-dump in that out-of-memory situation? I thought the "HeapDumpOnOutOfMemoryError" option was meant to trigger exactly that. Such a heap-dump would be most helpful if not essential to be able to figure out where our memory leak sits.
This is using Java 8 (AdooptOpenJDK 8u252) on SLES 12 and there is definitely enough diskspace left for the heap-dump!