How to Create a Heap Dump for Datameers Java Process

Goal

On occasion, Engineering may request collecting a Heap Dump to troubleshoot an issue.

Learn how to create a Heap Dump.

Learn

Step-by-step guide

Add the steps involved:

  1. Ensure that Datameer is running to be able to generate a Heap Dump.
  2. Run the following command: "ps -ef | grep conductor"
    1. Note the PID of the conductor process to be able to generate the Heap Dump.
    2. Note the full path to the "java" binary that is running the Datameer instance.
  3. Navigate to the directory noted in step 2.1.
  4. Run the following command to create a heap dump: ./jmap - dump:format=b,file=/tmp/heap.bin <PID>
  5. Collect the resulting /tmp/heap.bin file for review. 

Note that if the file should compress well. If the file will be copied over a network, it is recommended to compress and decompress the file before and after the transfer. 

Example

For reference, here is an example from a lab environment:

datameer$ ps -ef | grep conductor
  501  5961     1   0  3:04PM ttys000    0:58.11 /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin/java -Xmx2048m -XX:MaxPermSize=384m -Xms256m -XX:MaxNewSize=448m -XX:SurvivorRatio=6 -XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=80 -XX:+HeapDumpOnOutOfMemoryError -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled -Dfile.encoding=utf-8 -server -Ddeploy.mode=live -Ddb.name=dap450 -Dconductor.customer=Unknown -Djetty.port=8080 -XX:HeapDumpPath=/opt/datameer/current/logs/heapdump.log -Dlog4j.configuration=file:///opt/datameer/current/conf/log4j-production.properties -Djetty.home=/opt/datameer/current -Djava.io.tmpdir=tmp -Djava.library.path=/opt/datameer/current/lib/native -jar /opt/datameer/current/start.jar /opt/datameer/current/etc/jetty-logging.xml /opt/datameer/current/etc/jetty.xml
  501  5984  5745   0  3:12PM ttys000    0:00.00 grep conductor

In this example, the PID of the Datameer instance is 5961. The full path to the java binary is: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin

datameer$ cd /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/bin
datameer$ ./jmap -dump:format=b,file=/tmp/heap.bin 5961
Dumping heap to /tmp/heap.bin ...
Heap dump file created