Creating Java Thread Dump and Runtime Snapshot using VisualVM

Java VisualVM is a powerful tool for monitoring, troubleshooting, and profiling Java applications - like jBEAM is.

The thread dump is necessary to analyse permanently blocked processes, such as frozen GUIs. Whereas the runtime snapshot more helps to analyze long-running processes.

It is usually helpful to provide us with both pieces of information.

Installing VisualVM

Previously this tool was part of every Java JDK installation and is now published standalone here: https://visualvm.github.io/

  1. I.e. on Microsoft Windows download it as zip file. Because it does not need to be installed system wide.

  2. Extract it to a location you have write permission to.

  3. Inside find the …/bin/visualvm.exe to start the VisualVM tool.

Start jBEAM and connect to VisualVM

  • Now start jBEAM but do not start the problematic/ long-running process yet.

  • Notice the com.AMS.jBEAM_Extern.jBMain (…) node in VisualVM’s left panel.

image-20240708-133351.png

Performing a Thread Dump

  1. Start the problematic process in jBEAM (and let it run for a few seconds).

  2. In VisualVM find the …jBMain … node.

  3. Press Thread Dump in the context menu.

  1. Select the newly created threaddump node and press Save As… in the context menu.

 

  1. Send us this .tdump file.

Performing a Runtime Snapshot

  1. Make sure jBEAM is startet.

  2. In VisualVM doubleclick the …jBMain … node.

  3. Now, to find out what and why the jBEAM processes take so long, go to Sampler tab:

  4. Now go back to jBEAM and start the long-running task.

  5. And while it is running, go back to VisualVM in the Sampler tab - click the CPU button:

  6. Now let it run for a few seconds or minutes in this 'stuck' state and then press the Stop button. Followed by pressing the Snapshot button:

  7. Clicking the Snapshot button opens a new “[snapshot] …“ tab: inside it, find the disc icon and press the Export Snapshot Data context menu entry:

  8. Send us the created .nps file.