Linux Diagnostic Information

June 19th, 2020

When the Mango process is stuck or performing poorly it can be useful to dump the thread stacks and object counts from memory to get a better picture of what is happening inside the JVM. Note that some of the JDK commands will not be on your path so you may need to find them in your jdk/bin installation directory.

Find Mango pid

To get the full output of the command used to run Mango:

ps aux | grep java

When Mango starts it adds its main pid to this file:

cat /<MA_HOME>/bin/

Memory Map Dump

To count the number of size of each type of object in Mango’s memory use this command. It will output the count in descending order and can be useful to see what is using the majority of memory in the JVM.

jmap -histo <pid> > mangoMemMap.txt

Heap Dump

Heap dumps are larger files that contain a snapshot in time of the entire JVM memory space and are a way to do a more detailed analysis using tools that show the connections between all the objects in memory. When diagnosing memory problems this is the best way to ‘see’ into the heap of a running JVM. It is recommended to use JVisualVM or MAT when analyzing the generated files.

To generate a full heap dump with objects that are ready for garbage collection use this (Note the file will be significantly bigger)

jmap -dump:format=b,file=mangoHeapFull <pid>
jmap -dump:live,format=b,file=mangoHeapLive <pid>

Thread Dump

A thread dump can be helpful when Mango seems to be hung on shutdown or just not performing as expected. They can be retrieved via the REST api and processed for statistics using this Python script:


Another option is via the command line:

jstack -l  <pid> > mangoThreads.txt

Copyright © 2020 Radix IoT, LLC.