Generating a Thread Dump Externally

If Confluence stops responding and you cannot access its integrated Generate Thread Dump feature, it is possible to create thread dumps outside the application. External thread dumps are also useful if you require information on locks being held or waited upon by threads.

Take Multiple Thread Dumps

Typically you'll want to take several dumps about 10 seconds apart, in which case you can generate several dumps and output the stack traces to a single file as follows:

Generating a Thread Dump on Linux, including Solaris and other Unixes

  1. Identify the java process that Confluence is running in.: This can be achieved by running a command similar to:

    ps -ef | grep java.
    
  2. Find the process ID of the JVM and use the ps command to get list of all processes:

    kill -3 <pid>
    

    This will not kill your server (so long as you included the "-3" option, no space in between).

    Output

    Standard logging for Confluence Stand-alone is sent to the atlassian-confluence.log, in the confluence-home directory, not in the confluence-install directory. Thread dumps are an exception since they dump the threads of the entire application server - they'll appear in the catalina.out file in the application directory's logs folder. You can search for the term "thread dump" in the log file for the beginning of the dump. Submit this along with the atlassian-confluence.log in your support ticket.

Generating Thread Dumps on Windows

From the console

If you are running Confluence through a console, rather than as a service, you can click on the console and press <CTRL>+BREAK

Using jstack

The JDK ships with a tool named jstack for generating thread dumps.

  1. Identify the process. Launch the task manager by, pressing Ctrl + Shift + Esc and find the Process ID of the Java (Confluence) process. You may need to add the PID column using View -> Select Columns ...
  2. Run jstack <pid> to Capture a Single Thread Dump. This command will take one thread dump of the process id <pid>, in this case the pid is 22668:

    adam@track:~$ jstack -l 22668 > threaddump.txt
    

    This will output a file called threaddump.txt to your current directory.

Common issues with jstack:

  • You must run jstack as the same user that is running Confluence
  • If the jstack executable is not in your $PATH, then please look for it in your <JDK_HOME>/bin directory
  • If you receive java.lang.NoClassDefFoundError: sun/tools/jstack/JStack check that tools.jar is present in your JDK's lib directory. If it is not, download a full version of the JDK.
  • If you see the following message: 'Not enough storage is available to process this command,' see this article.

Output

Standard logging for Confluence Stand-alone is sent to the atlassian-confluence.log, in the confluence-home directory, not in the confluence-install directory. Thread dumps are an exception since they dump the threads of the entire application server - they'll appear in the catalina.out file in the application directory's logs folder. You can search for the term "thread dump" in the log file for the beginning of the dump. Submit this along with the atlassian-confluence.log in your support ticket.

Thread Dump Analysis Tools

Was this helpful?

Thanks for your feedback!

Why was this unhelpful?

Have a question about this article?

See questions about this article

Powered by Confluence and Scroll Viewport