Jira is not responsive due to a long class unloading during GC operations
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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
Problem
Jira stops responding due to a long class-unloading during the Young allocation. The following appears in the GC logs:
1
2
3
4
5
6
....
....
2021-05-03T08:18:08.474+0000: 7248850.541: [Unloading, 226.2160260 secs], 226.2848696 secs]
[Times: user=1.63 sys=0.00, real=226.29 secs]
....
....
Diagnosis
Diagnostic Steps
Response time increases whereas the throughput is low, the number of HTTP threads & DB connection count are not high:

GC Viewer does not show any Full GCs but the GC throughput is very low:

ℹ️ The yellow area shows the Young Generation collections
Cause
The problem with JDK8 was that sometimes the class unloading step of remarking phase is taking a very long time to do its job. They were running with large pages enabled with both JDK7 and JDK8. What changed in the JVM from JDK7 to JDK8 is that there isn't PermGen in JDK8. It's replaced with MetaSpace which is allocated out of native memory space.
With JDK7 by using option -XX:+UseLargePages, the large pages are enabled for the Java Heap as well as for the PermGen. But within JDK8, with the class metadata stored in MetaSpace(Native Space), we don't get large pages enabled for the MetaSpace by default when we use +UseLargePages.
In this particular case, the system was configured to have a higher number of large pages and a limited memory resource was left for the regular small pages. And a limited number of regular pages available for the MetaSpace caused paging activity during the class unloading phase leading to long GC pauses.
Solution
Resolution
Append -XX:+UseLargePagesInMetaspace into the JVM arguments by following the steps in Setting properties and options on startup article to enable the large pages support for the MetaSpace and to avoid the long-running paging activities and class-unloading.
⚠️ Please note that UseLargePagesInMetaspace is not enabled by default when UseLargePages is ON. So, ensure that UseLargePages is not in the JVM arguments.
Was this helpful?