Uploaded image for project: 'Jira Data Center'
  1. Jira Data Center
  2. JRASERVER-66687

DefaultFieldLayoutManager.getUniqueFieldLayouts generates high memory pressure on large JIRA instances

XMLWordPrintable

      Summary

      Method DefaultFieldLayoutManager.getUniqueFieldLayouts might allocate a lot memory during execution while collecting required data, that generates high memory pressure to JVM on large JIRA instances. This might lead to expensive GC and/or OOM events.

      Environment

      Large JIRA instance

      • 1k+ CustomFields
      • 100 Field Configurations

      Steps to Reproduce

      1. Trigger the call to com.atlassian.jira.issue.fields.layout.field.DefaultFieldLayoutManager#getUniqueFieldLayouts
        • Note that this method is frequently used in many JQL checks as part of DefaultFieldManager.isFieldHidden or FieldClausePermissionChecker.hasPermissionToUseClause

      Expected Results

      Method will allocate small amount of memory (up to 10MB) or no memory.

      Actual Results

      Method allocated 100+MB of memory

      Notes

      • Memory size by uniqueLayouts is driven by 2 factors:
        • Size of the list - can be large due the large project list using Field Configurations
        • Size of the element - FieldLayoutImpl , eg, in this specific case memory size of FieldLayoutImpl is 4.5MB
          Object / Stack Frame                                                                       |Name| Shallow Heap | Retained Heap |
          --------------------------------------------------------------------------------------------------------------------------------
          key com.atlassian.jira.issue.fields.layout.field.FieldLayoutImpl @ 0x6254a9cb0             |    |           48 |     4,485,552 |
          |- <class> class com.atlassian.jira.issue.fields.layout.field.FieldLayoutImpl @ 0x3d09315c8|    |            0 |             0 |
          |- id java.lang.Long @ 0x5729c4df0  17935                                                  |    |           24 |            24 |
          |- description java.lang.String @ 0x623eeab20  GreenHopper Scrum Story Field Configuration |    |           24 |           128 |
          |- name java.lang.String @ 0x623eeabf0  ProjectA Story Field Configuration           |    |           24 |           120 |
          |- genericValue org.ofbiz.core.entity.GenericValue @ 0x623eeac68                           |    |           56 |           672 |
          |- fieldLayoutItemByFieldId java.util.HashMap @ 0x62d9b9220                                |    |           48 |       160,960 |
          |- fieldLayoutItems java.util.ArrayList @ 0x62ebe0970                                      |    |           24 |        16,056 |
          --------------------------------------------------------------------------------------------------------------------------------
          
        • mostly contributed by CustomFields (through fieldLayoutItem)
      • Problem get more amplified during cache flush events, eg: JRASERVER-64908, JRASERVER-61166

      Workaround

      • Reduce number of Field Configurations by deleting unused and reusing existing for another project.
      • Reduce number of CustomFields, this will reduce memory footprint for FieldLayoutImpl and also will have other improvements

              Unassigned Unassigned
              ayakovlev@atlassian.com Andriy Yakovlev [Atlassian]
              Votes:
              3 Vote for this issue
              Watchers:
              15 Start watching this issue

                Created:
                Updated: