Adobe
Products

Top destinations

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • SiteCatalyst
  • Students
  • Elements family

Adobe Creative Cloud

  • What is Adobe Creative Cloud?
  • Design
  • Web
  • Photography
  • Video
  • Students
  • Teams
  • Enterprise
  • Educational institutions

Design and photography

  • Photoshop
  • Illustrator
  • InDesign
  • Adobe Muse
  • Lightroom

Video

  • Adobe Premiere
  • After Effects

Web development and HTML5

  • Edge Tools & Services [opens in a new window]
  • Dreamweaver
  • Gaming [opens in a new window]

Adobe Marketing Cloud

  • What is Adobe Marketing Cloud?
  • Digital analytics
  • Social marketing
  • Web experience management
  • Testing and targeting
  • Media optimization

Analytics

  • SiteCatalyst
  • Adobe Discover
  • Insight

Social

  • Adobe Social

Experience Manager

  • CQ
  • Scene7

Target

  • Test&Target
  • Recommendations
  • Search&Promote

Media Optimizer

  • AdLens
  • AudienceManager
  • AudienceResearch

Document services

  • Acrobat
  • EchoSign [opens in a new window]
  • FormsCentral [opens in a new window]
  • SendNow [opens in a new window]
  • Acrobat.com [opens in a new window]

Publishing

  • Digital Publishing Suite

  • See all products
Business solutions

By business need

  • Digital analytics
  • Digital publishing
  • Document management
  • Media optimization
  • Social marketing
  • Testing and targeting
  • Video editing and serving
  • Web development [opens in a new window]
  • Web experience management
  • See all business needs

By industry

  • Broadcast
  • Education
  • Financial services
  • Government
  • Publishing
  • Retail
  • See all industries
Support & Learning

I need help

  • Products
  • Adobe Creative Cloud
  • Adobe Marketing Cloud
  • Forums [opens in a new window]

I want to learn

  • Training and tutorials
  • Certification [opens in a new window]
  • Adobe Developer Connection
  • Adobe Design Center
  • Adobe TV [opens in a new window]
  • Adobe Marketing Center
  • Adobe Labs [opens in a new window]
Download
  • Product trials
  • Adobe Flash Player
  • Adobe Reader
  • Adobe AIR
  • See all downloads
Company
  • Careers at Adobe
  • Investor Relations
  • Newsroom
  • Privacy
  • Corporate Social Responsibility
  • Customer Showcase
  • Contact us
  • More company info
Buy
  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers
  • Adobe Marketing Cloud sales [opens in a new window]
Search
 
Info Sign in
Why sign in? Sign in to manage your account and access trial downloads, product extensions, community areas, and more.
Welcome,
My Adobe
My orders
My information
My preferences
My products and services
Sign out
My cart
Privacy My Adobe
Adobe
Products Sections Buy   Search  
Solutions Company
Help Learning
Sign in Sign out Privacy My Adobe
Date Date
Qty:
Subtotal
Promotions
Estimated Shipping
VAT
Calculated at checkout
Total
Checkout
Adobe CQ Help / 

How to take Thread Dumps from a JVM

Adobe Community Help


Products Affected

  • Adobe CQ

Contact support

 
By clicking Submit, you accept the Adobe Terms of Use.
 
  • Question
  • Answer, Resolution
    • Step 1: Get the PID of your java process
    • Step 2: Request a Thread Dump from the JVM
      • jstack
      • jstack script
      • Alternative Ways to Obtain a Thread Dump
        • Unix, Mac OSX and Linux (JDK 1.4 or lesser version)
        • Windows:
          • JDK 1.X-1.5
          • JDK 1.6
  • Applies to

Question

A thread dump is a list of all the Java threads that are currently active in a Java Virtual Machine (JVM).

How can I take thread dumps from a JVM on Unix or Windows?

Answer, Resolution

There are several ways to take thread dumps from a JVM. It is highly recommended to take more than 1 thread dump. A good practice is to take 10 thread dumps at a regular interval (eg. 1 thread dump every 10 seconds).

Step 1: Get the PID of your java process

The first piece of information you will need to be able to obtain a thread dump is your java process's PID.

The java JDK ships with the jps command which lists all java process ids. You can run this command like this: jps -l

70660 sun.tools.jps.Jps

70305

Note: In Linux and UNIX, you may have to run this command as sudo -u user jps -l, where "user" is the username of the user that the java process is running as.

If this doesn't work or you still cannot find your java process, (path not set, JDK not installed, or older Java version), use

  • UNIX, Linux and Mac OSX:
    ps -el | grep java
  • Windows:
    Press Ctrl+Shift+Esc to open the task manager and find the PID of the java process

Step 2: Request a Thread Dump from the JVM

jstack

If installed/available, we recommend using the jstack tool. It prints thread dumps to the command line console.

To obtain a thread dump using jstack, run the following command:
jstack <pid>

You can output consecutive thread dumps to a file by using the console output redirect/append directive:
jstack <pid> >> threaddumps.log

Notes:

  • The jstack tool is available since JDK 1.5 (for JVM on Windows it's available in some versions of JDK 1.5 and JDK 1.6 only).
  • jstack works even if the -Xrs jvm parameter is enabled
  • It's not possible to use the jstack tool from JDK 1.6 to take threaddumps from a process running on JDK 1.5.
  • In Linux and UNIX, you may need to run this command as sudo -u user jstack <pid> >> threaddumps.log, where "user" is the user that the java process is running as.
  • In Windows, if you run jstack and get the error "Not enough storage is available to process this command" then you must run jstack as the windows SYSTEM user.  You can do this by using psexec which you can download here. Then you can run jstack like this:
    psexec -s jstack <pid> >> threaddumps.log

jstack script

Here's a script, taken from eclipse.org that will take a series of thread dumps using jstack.

#!/bin/bash
if [ $# -eq 0 ]; then
    echo >&2 "Usage: jstackSeries <pid> <run_user> [ <count> [ <delay> ] ]"
    echo >&2 "    Defaults: count = 10, delay = 0.5 (seconds)"
    exit 1
fi
pid=$1          # required
user=$2         # required
count=${3:-10}  # defaults to 10 times
delay=${4:-0.5} # defaults to 0.5 seconds
while [ $count -gt 0 ]
do
    sudo -u $user jstack -l $pid >jstack.$pid.$(date +%H%M%S.%N)
    sleep $delay
    let count--
    echo -n "."
done

Just run it like this:
sh jstackSeries.sh [pid] [cq5serveruser] [count] [delay]

For example:
sh jstackSeries.sh 1234 cq5serveruser 10 3

  • 1234 is the pid of the java process
  • cq5serveruser is the Linux or Unix user that the java process runs as
  • 10 is how many thread dumps to take
  • 3 is the delay between each dump):

Alternative Ways to Obtain a Thread Dump

If the jstack tool is not available to you then you can take thread dumps as follows:

Note: Some tools cannot take thread dumps from the JVM if the commandline parameter -Xrs is enabled. If you are having trouble taking thread dumps then please see if this option is enabled.

Unix, Mac OSX and Linux (JDK 1.4 or lesser version)

On Unix, Mac OSX and Linux, you can send a QUIT signal to the java process to tell it to output a thread dump to standard output.

  1. Run this command to do this:
    kill -QUIT <pid>
    You may need to run this command as sudo -u user kill -QUIT <pid> where "user" is the user that the java process is running as.
  2. If you are starting CQSE using the crx-quickstart/server/start script then your thread dumps will be output to crx-quickstart/server/logs/startup.log. If you are using a 3rd party application server such as JBoss, WebSphere, Tomcat, or other then please see the server's documentation to find out which file the standard output is directed to.
Windows:
JDK 1.X
  1. Download javadump.exe (Attached below)
  2. Start the JVM with these 3 arguments. They must be in the right order.
    -XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=C:\tmp\jvmoutput.log
  3. Press Ctrl+Shift+Esc to open the task manager
  4. Find the PID of the java process
  5. From the command line run
    javadump.exe [pid]
  6. The thread dump will appear in the jvmoutput.log file mentioned in step 2.

JDK 1.6

Get a thread dump from jconsole tool, by using a plugin : [0]

Here's how you can request a thread dump:

  1. Add the following parameter to the jvm running Communique : -Dcom.sun.management.jmxremote
  2. Download and install JDK 1.6 (if not done yet)
  3. Download and extract the Thread Dump Analyzer utility [1]
  4. Run jconsole.exe of JDK 1.6
    jconsole.exe -pluginpath /path/to/file/tda.jar
  5. Click on the Thread dumps tab
  6. Click on the Request Thread Dump ... link

Note: If you are running CQ5 and or CRX (with Sling) and want to observe the running threads, you can request http://<host>:<port>/system/console/threads to get a thread list. However, please note that these thread dumps will not work with thread dump analysis tools such as samurai or tda.

Applies to

All Day Products running in a JVM

[0] http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
[1] http://www.jroller.com/dumpster/entry/tda_as_jconsole_plugin
[2] https://tda.dev.java.net/files/documents/4691/113000/tda-bin-2.1.zip
[3] http://docs.day.com/en/home/docutools/javadump_exe.html

* javadump.exe
* parse-jstack-1.0-SNAPSHOT.jar
Keywords: CQ

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy

Products

  • Adobe Creative Cloud
  • Creative Suite
  • Adobe Marketing Cloud
  • Acrobat
  • Photoshop
  • Digital Publishing Suite
  • Elements family
  • SiteCatalyst
  • For education

Download

  • Product trials
  • Adobe Reader
  • Adobe Flash Player
  • Adobe AIR

Support & Learning

  • Product help
  • Forums

Buy

  • For personal and professional use
  • For students, educators, and staff
  • For small and medium businesses
  • Volume Licensing
  • Special offers

Company

  • News room
  • Partner programs
  • Corporate social responsibility
  • Career opportunities
  • Investor Relations
  • Events
  • Legal
  • Security
  • Contact Adobe
Choose your region United States (Change)
Choose your region Close

North America

Europe, Middle East and Africa

Asia Pacific

  • Canada - English
  • Canada - Français
  • Latinoamérica
  • México
  • United States

South America

  • Brasil
  • Africa - English
  • Österreich - Deutsch
  • Belgium - English
  • Belgique - Français
  • België - Nederlands
  • България
  • Hrvatska
  • Česká republika
  • Danmark
  • Eastern Europe - English
  • Eesti
  • Suomi
  • France
  • Deutschland
  • Magyarország
  • Ireland
  • Israel - English
  • ישראל - עברית
  • Italia
  • Latvija
  • Lietuva
  • Luxembourg - Deutsch
  • Luxembourg - English
  • Luxembourg - Français
  • الشرق الأوسط وشمال أفريقيا - اللغة العربية
  • Middle East and North Africa - English
  • Moyen-Orient et Afrique du Nord - Français
  • Nederland
  • Norge
  • Polska
  • Portugal
  • România
  • Россия
  • Srbija
  • Slovensko
  • Slovenija
  • España
  • Sverige
  • Schweiz - Deutsch
  • Suisse - Français
  • Svizzera - Italiano
  • Türkiye
  • Україна
  • United Kingdom
  • Australia
  • 中国
  • 中國香港特別行政區
  • Hong Kong S.A.R. of China
  • India - English
  • 日本
  • 한국
  • New Zealand
  • 台灣

Southeast Asia

  • Includes Indonesia, Malaysia, Philippines, Singapore, Thailand, and Vietnam - English

Copyright © 2013 Adobe Systems Incorporated. All rights reserved.

Terms of Use | Privacy | Cookies

Ad Choices

Reviewed by TRUSTe: site privacy statement