Heap Dump on OutOfMemoryError - alexpron/shanoir-ng GitHub Wiki
This page might help you get and analyze the java heap dump in case of a OutOfMemoryError.
the java run command look like this :
ENTRYPOINT ["/bin/entrypoint", "java",...
so add those
-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=/tmp/heapdumps
On crash a heap dump file that could weight several Gb will be written in /tmp/heapdumps, into the docker container
On the qualif env, the /tmp is mounted via a docker volume to this directory on the docker host that you access with ssh :
/nas/shanoir-tmp/<instance-name>
Then you can scp it from your local machine with :
scp <ssh-user-name>@<ssh_ip>:/nas/shanoir-tmp/<instance-name-dir>/heapdumps ./
BUT ! you will need these rights :
- unix read right
- since the file is written by root your user on the server will not have the right to read or copy the file
- here is a hack : if you use
dk shellto log into the docker container you will be root and will be able to go to/tmp/heapdumpsandchmodthe file.
- right to scp (that doesn't necessary comes with ssh right)
- you will have to ask the server administrator
You can use Eclipse Memory Analyzer, which can run as a standalone software without the need of Eclipse.
- Rename your heapdump file with a .hprof extension
- After install, click File > Open Heap Dump
- It can take so times to parse
- You may have a heap space error parsing the heap dump (how ironic)
- if so increase the max memory :
- open the
MemoryAnalyzer.inifile - change the default
-Xmx1024mto a larger size
- open the
- the failed parsing will maybe block you, rename the heap dump file and start a new parsing
- if so increase the max memory :
- I like the view "dominator tree" to sort the java objects by size