Analyze OutofMemory errors in Jira server with Heap Dumps

Still need help?

The Atlassian Community is here for you.

Ask the community

Heap Dumps

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.
There are arguments that will tell the Java Virtual Machine (JVM) to do this automatically when it encounters an OutOfMemoryError (OOME).
These heap dumps can then be analyzed to identify problems within JIRA applications.

Diagnosis

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 is used to set 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, as in this documentation. However, if a heap dump is not generated when an OutOfMemoryError is thrown, it is generally not very useful.

Analysis

  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.

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 Mar 11, 2024

Was this helpful?

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