Heap Dump On Out of Memory Error

The parameter -XX:+HeapDumpOnOutOfMemoryErrorcan be set to enable heap dump when the JVM runs out of memory. You have set this parameter in the BW_JAVA_OPTS environment variable.

For Example, BW_JAVA_OPTS="-Xmx1024M -Xms1024M -XX:+HeapDumpOnOutOfMemoryError

Once JVM throws OOM exception heapdump snapshots gets generated and it gets stored within the container. Please follow the below steps to copy the heapdump snapshot from container to your local machine:
  • Connect to the container
    • docker exec -it <containerID> bash
  • Copy the snapshot from a container to the local machine
    • docker cp <containerId>:/filepath/within/container/host/path/target

By default the heapdump snapshot gets stored in the root location with the name java_pid1.hprof.