Thread dumps are critical for root cause analysis and are often required to effectively resolve application issues. At times of application problems, thread dumps need to be collected at least 3~5 times with 10~15 second interval. Create a convenient script to generate thread dumps from the JVM running WLS server. The following script is a working example and can be further customized to fit specific needs. Run the script to take thread dumps before shutting down the WLS server instance at times of problems.
#! /usr/bin/ksh
# This shell scripts takes a pid and kill -3 the pid to take thread dump.
if [[ 1 != $# ]]
then
echo "Usage: $0 "
exit 1
fi
let j=1
# The loop controls the number of times thread dumps are taken
while [[ $j -le 5 ]]
do
echo kill -3 $1
kill -3 $1
# take a small pause before getting the next thread dump
sleep 15
let j=$j+1
done
Good Post.. very useful.
ReplyDeleteThanks,
www.wikiconsole.com