Analyze OutofMemory errors in Jira Server and Data Center with heap dumps

Still need help?

The Atlassian Community is here for you.

Ask the community

Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

One of the most effective ways of troubleshooting and identifying memory problems within Jira applications is to have Java output the contents of its memory into a heap dump.
Some arguments will tell the Java Virtual Machine (JVM) to do this automatically when it encounters an OutOfMemoryError (OOME).
Heap dumps can then be analyzed to identify problems within Jira applications.

Configure JVM to generate heap dumps

To enable the JVM to generate a heap dump on an OutOfMemoryError, add the following arguments to the JVM as in our Setting Properties and Options on Startup documentation. If you use your $JIRA_INSTALL directory for this, it will be easy to locate.
(If JIRA applications run out of memory, it will create a jira_pid*.hprof file containing the heap dump in the directory specified in the parameter -XX:HeapDumpPath. )

(info) Optional: The -XX:HeapDumpPath parameter sets the location where the heap dump will be generated. If it is not used, the heap dump will be generated within the Java working directory.

-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/atlassian/jira/logs

If you are running Jira on Windows and this setting has been configured in the Windows registry (i.e. because Jira is running as a service), then each parameter needs to be placed on a new line, for example:

-XX:+HeapDumpOnOutOfMemoryError
-XX:HeapDumpPath=C:\Program Files\Atlassian\JIRA\logs

(info) Jira needs to be restarted for these changes to take effect 

When a heap dump is generated, it will be the size of the current heap (e.g.: a 4GB heap will have a 4GB heap dump). In a system with a larger heap configured, this means a larger heap dump will be generated. Please ensure that the path is set for a location with plenty of disk space.

It is also possible to manually generate a heap dump. However, if a heap dump is not generated when an OutOfMemoryError is thrown, it is generally not very useful.

Manually generate a heap dump when Jira utilizes high memory or stops responding

It is also possible to get a heap dump manually using a JDK bundled tool called jmap, although we recommend that you use the automatic method above for best result.

For Linux/Solaris-based Operating Systems:

Please execute the following command on Linux OS:

$JAVA_HOME/bin/jmap -dump:format=b,file=heap.bin <pid>

For Windows:


Please find your Confluence process ID (see below) and then execute the command below on a Windows command line:

%JAVA_HOME%\bin\jmap -dump:format=b,file=heap.bin <pid>

To find out the process ID for your Java process in Windows, you can use Process Explorer from Microsoft. 

Analyze the heap dump to understand the error

  1. After a heap dump is generated, it can be analyzed with VisualVM or Eclipse' MAT.
  2. Oracle also has a Troubleshooting Guide for Java.

In addition to heap dumps, you can also use GC logging for analysis. Please refer to our Troubleshoot Jira Server performance with GC logs KB article for further information on this.

There are no one size fits all recommendations

It is unwise to provide general recommendations for all situations - there is no substitute for an in-depth assessment using analysis tools. Atlassian recommends engaging the services of an Atlassian Expert for performance analysis of Jira applications and the environment they run in.

Last modified on Dec 17, 2024

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.