Java Heap Dump parameter not generating dumps in specified path and app crashes due to out of memory

I am using the Java Out-of-Memory heap dump parameter (-XX:+HeapDumpOnOutOfMemoryError) to help diagnose issues with my application crashing due to out of memory errors. However, I am having trouble finding the heap dumps in the path that I specified (-XX:HeapDumpPath=/my-app/dumps).

I have verified that the parameter is being passed correctly. However, when my application crashes, no heap dumps are generated in the specified path.

This is a problem for me because my app crashes all the time due to out of memory errors, and I need to analyze the heap dumps to understand the root cause of the issue.

If anyone has any suggestions on how I can troubleshoot this problem, I would greatly appreciate your input.

I don’t think the JVM can intervene when it is the Kernel that OOMs your app?

Each time Fly boots up an app, it does so on a clean volume, so persisting crash dumps on what’s essentially ephemeral isn’t going to help.

Try allocating and mounting a persistent volume onto your app (ref, docs) and see if heap dumps survive there.

Also, if it is possible to write out heap dumps to stdout, then you can grab the logs via fly-log-shipper or fly-log-local (ref).

Thanks! I’ll check the docs you’ve shared

1 Like