Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question

How do I get a thread dump on Linux

Hi, I wonder how I can get a thread dump on Linux without using a worker. I tried to do kill -QUIT spid but nothing returns. I also tried jstack and it seems to be hanging there and nothing returns either. I can use kill -QUIT to get the thread dump of the other Java applications running on the same Linux box though.


{quote}This thread was imported from the previous forum. For your reference, the original is [available here|http://forum.openspaces.org/thread.jspa?threadID=2620]{quote}

asked 2008-09-25 11:46:14 -0600

jye gravatar image

updated 2013-08-08 09:52:00 -0600

jaissefsfex gravatar image
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

Kill -3 pid Should generate a file with the thread dump.


answered 2008-09-25 17:47:56 -0600

shay hassidim gravatar image
edit flag offensive delete link more

Usually Thread dump is printed to the console by the JVM. So when you are starting the space try to redirect the output to a file. Some thing like this

./gsc.sh > outputfilename &

When u run kill Quit it will print the thread dump to the output file

For easy monitoring here is the script which will automatically take the thread dump when CPU goes over some limit.
More info at


  1. # This script can be used to monitor the GigaSpaces process taking up high CPU.
  2. If the CPU usage reaches the threshold limit this script triggers a Thread dump
  3. for the process that can prove be useful in identifying the thread(s) causing the
  4. High CPU Usage

if $# -lt 2 ; then
  echo ""
  echo "USAGE: ./tdump.sh <CPU> <TIME>"
  echo ""
  echo " <CPU> - CPU Utilization in percents (%)"
  echo " <TIME> - Time in seconds"
  echo ""
  echo "Example: ./tdump.sh 70 10 "

pidList1=`ps -eaf|grep com.gigaspaces.start.SystemBoot|grep -v grep| awk '{line = line " " $2} ; END {print line}'`
pidList2=`ps -eaf|grep com.j_spaces.core.client.SpaceFinder|grep -v grep| awk '{line = line " " $2} ; END {print line}'`
pidList="${pidList1} ${pidList2}"
echo "PID's currently active " $pidList

declare -a chk
for curPid in $pidList; do

while 1

for curPid in $pidList; do
      str=`ps --pid $curPid --no-headers -o pcpu,rss,pid,cmd| grep java `
      cpu=`echo $str | awk '{print $1}'|cut -d. -f1`
mem=`echo $str | awk '{print $2}'`

if $cpu -gt $CPUUSAGE ; then
         echo "* $dt PID= $curPid CPU= $cpu % MEMORY= $mem K"
         chk$curPid=`expr ${chk$curPid} + 1`
      if ${chk[$curPid} -ge $TIME ];then
         echo "********************************************************************"
         echo "* $dt PID= $curPid CPU= $cpu % MEMORY= $mem K"
         echo "* CPU Threashold breached triggering Thread dump"
         echo "********************************************************************"
         kill -s SIGQUIT $curPid
   sleep 1

answered 2008-09-25 13:53:14 -0600

venkatg gravatar image
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2008-09-25 11:46:14 -0600

Seen: 2,181 times

Last updated: Sep 25 '08