-
Notifications
You must be signed in to change notification settings - Fork 197
Taking and interpreting a JVM thread dump
Silvio Moioli edited this page Dec 18, 2020
·
6 revisions
Ever wanted to know what's going on exactly in the JVM, when a debugger is not available (eg. at a customer?)
A thread dump will provide an instant snapshot of all stacks, in all threads. Sometimes that is sufficient.
zypper in java-11-openjdk-devel
# Tomcat
jstack `ps aux | grep catalina.startup | grep -v grep | awk '{print $2}'`
# Taskomatic
jstack `ps aux | grep TaskomaticDaemon | grep -v grep | awk '{print $2}'`
The following Bash script can be used to obtain Tomcat dumps every 5 seconds:
#!/bin/bash
mkdir /tmp/tomcat_thread_dump_monitor
while :
do
jstack `ps aux | grep catalina.startup | grep -v grep | awk '{print $2}'` > /tmp/tomcat_thread_dump_monitor/`date --iso-8601=seconds`-dump.txt
sleep 5
done