Analyze OutofMemory errors in Jira server with 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 analysed to identify problems within JIRA applications.
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 JIRA applications run out of memory, it will create a
jira_pid*.hprof file containing the heap dump in the directory specified below. If you use your
$JIRA_INSTALL directory for this, it will be easy to locate.
Optional: Using 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.
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
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 larger heap allocated, 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 at all useful.
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.
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.