Linux Commands Examples

A great documentation place for Linux commands

jstack

Stack Trace

Synopsis

jstack [ option ] pid
jstack
[ option ] executable core
jstack
[ option ] [server-id@]remote-hostname-or-IP


add an example, a script, a trick and tips

: email address (won't be displayed)
: name

Step 2

Thanks for this example ! - It will be moderated and published shortly.

Feel free to post other examples
Oops ! There is a tiny cockup. A damn 404 cockup. Please contact the loosy team who maintains and develops this wonderful site by clicking in the mighty feedback button on the side of the page. Say what happened. Thanks!

examples

0
source
            
PID=$1
jstack $PID > thread-dump
jmap -dump:file=heap-dump $PID
0
source
            
jstack 14708 | grep -A3 nid=`printf "0x%x\n" 14740`
0
source
            
echo "Java thread dump start."
jstack $java_proc_id > jstack-$now.log
echo "Java thread dump finish. -> $current_dir/jstack-$now.log created."

description

jstack prints Java stack traces of Java threads for a given Java process or core file or a remote debug server. For each Java frame, the full class name, method name, ’bci’ (byte code index) and line number, if available, are printed. With the -m option, jstack prints both Java and native frames of all threads along with the ’pc’ (program counter). For each native frame, the closest native symbol to ’pc’, if available, is printed. C++ mangled names are not demangled. To demangle C++ names, the output of this command may be piped to c++filt. If the given process is running on a 64-bit VM, you may need to specify the -J-d64 option, e.g.:

jstack -J-d64 -m pid

NOTE - This utility is unsupported and may or may not be available in future versions of the JDK. The only form of jstack that is available on Windows platforms is

jstack pid

options

-F

Forces a stack dump when ’jstack pid’ does not respond.

-m

prints mixed mode (both Java and native C/C++ frames) stack trace.

-h

prints a help message.

-help

prints a help message

known bugs

Mixed mode stack trace, the -m option, does not work with the remote debug server.

parameters

Options are mutually exclusive. Option, if used, should follow immediately after the command name. See OPTIONS.

pid

process id for which the stack trace is to be printed. The process must be a Java process. To get a list of Java processes running on a machine, jps may be used.

executable

Java executable from which the core dump was produced.

core

core file for which the stack trace is to be printed.

remote-hostname-or-IP

remote debug server’s (see jsadebugd) hostname or IP address.

server-id

optional unique id, if multiple debug servers are running on the same remote host.


see also

o

pstack

o

c++filt

o

jps

o

jsadebugd

How can this site be more helpful to YOU ?


give  feedback