Thread Dump How To Guide
This article describes the process of performing a Thread Dump of the Apache Tomcat JVM, in the event that Tomcat becomes unresponsive for some reason.
A thread dump can be useful in diagnosing low level Tomcat issues, which PINsafe can not report upon from within its Log Viewer.
The results of the Thread Dump by default are sent to /var/log/tomcat/catalina.out on PINsafe appliances, unless Tomcat has been configured differently.
Gain command line access
You will need to login to the PINsafe appliance using SSH to get to the CMI menu which is described in the PuTTY How To Guide. You will then need to gain access to the appliance command line from the CMI menu. A command line password is required for this.
Obtain the current process ID
To generate a thread dump you need to establish the live Process ID of Tomcat whilst it's running, which will be different each time it is started. You could use the following command:
netstat -anp | grep 8080
(Where 8080 is the port that Tomcat is running upon - 8080 is the default port on the PINsafe appliance)
This will output something along these lines:
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 5623/java
The part of the output that contains the Process ID is:
Generate a thread dump
So next we need to use the Process ID (5623) obtained above, to generate a thread dump. We use the following kill command:
kill -3 5623
This will then output the thread dump to /usr/local/tomcat/catalina.out.
Identifying the Thread Dump in the log
The thread dump will begin as follows:
Full thread dump Java HotSpot(TM) Client VM (16.0-b13 mixed mode, sharing): "derby.rawStoreDaemon" daemon prio=10 tid=0x081b4000 nid=0x166f in Object.wait() [0xb401c000] java.lang.Thread.State: TIMED_WAITING (on object monitor) at java.lang.Object.wait(Native Method) at org.apache.derby.impl.services.daemon.BasicDaemon.rest(Unknown
Extracting the logs
If using a PINsafe appliance you can use the WinSCP How To Guide article to learn how to extract files from the appliance.