Profile Image
MANJUSH BHUVANADAS

Is Capturing thread dumps using jstack is possible when process isn't responding?

Hi, 

 

To capture thread dumps using jstack

 

jstack -l <pid> >> threaddumps.log

 

If the java process isn't responding, then is it possible to use the option -J-d64 (on 64 bit systems), for example:
jstack -J-d64 -l <pid> >> threaddumps.log

 

but when I try this I get 

 

JVMJ9VM007E Command-line option unrecognised: -d64

 

Can you help with some jstack commands that we can use when the java process isn't responding

 

 

 

 

  • threaddumps

  • jstack

  • command-line

Please Sign In or to post your comment or answer

Profile Image

Ram Lakshmanan

Hello Manjush!

 

 You may try the following options:

 

a. 'kill -3 <PID>'. When you use this option thread dump will be printed in the standard error stream (not in your application log).

 

b. 'jstack -F <PID>'. When you use this option thread dump will be generated, but it will not contain all the information that will be present when use 'jstack -l <PID>' option. Thread dumps captured in this option will not contain thread state, lock Ids, ...

 

c. Here are 8 different options to capture thread dumps manually.

 

d. You can also use 14 day trial version of yCrash to capture and analyze thread dumps, GC logs, vmstat, iostat, netstat, dmesg... automatically.

 

 

Profile Image

MANJUSH BHUVANADAS

Thanks, Ram Laksmanan

 

When app is not responding, the first option to use is 'kill -3 <PID>'

 

If we run the Java process with the following combination of tuning flags, then it will also redirect the thread dump to the given file:

 

-XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=~/jvm.log

 

Then any possibility for performance issues in using 'kill -3 <PID>' and print the output in ~/jvm.log

 

Any best ways to capture the kill -3 <PID> outputs in Linux systems

Profile Image

Ram Lakshmanan

Yes Manjush! Agreed, makes sense. 

Profile Image

MANJUSH BHUVANADAS

Ram Lakshman,

 

Thanks a million

Profile Image

MANJUSH BHUVANADAS

Hi Ram Lakshman,

 

Trying to capture thread dump to a file using kill -3

 

Tried 


 -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=dump.log

This works but looking for something like 


jstack 17264 > /tmp/threaddump.txt

Any simple way to capture thread dump using kill -3 and output to a file using command

Profile Image

MANJUSH BHUVANADAS

Hi Ram Lakshmanan,

 

When 'kill -3 <PID>' and jstack -l <PID> works on the same mechanism to get a thread dump.

How kill -3 <PID> will be a better option when the app is sick or unresponsive

 

Like in my previous comment

 

Any simple and easy command to redirect to a file without passing jvm arguments in linux operating systems

 

kill -3 <PID>

Load More Comments

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • threaddumps

  • jstack

  • command-line