Accessing Queue Contents tab can cause an OutOfMemoryError (OOME)

XMLWordPrintable

    • 3
    • Severity 2 - Major
    • 42

      Issue Summary

      It is possible for Confluence instance/node to hit into an OutOfMemoryError (OOME) should a Confluence admin access the Queue Contents tab on Confluence Administration panel.

      The code to render the <Confluence-Base-URL>/admin/viewindexqueue.action page (Content Indexing page >> Queue Contents tab) forces Hibernate to fetch all entries whose IDs are mentioned in the index queue at the time from Confluence Database, filling up Confluence's memory.
      This is ok should the queue only has a few entries. However, if there are thousands records (or more) then that action will contribute extra overhead and exacerbate the problem. Each reload of this particular page is treated as a single request, adding yet an additional pressure to Confluence's memory.

      Steps to Reproduce

      1. Login to Confluence with Confluence administrator's privilege
      2. Access the <Confluence-Base-URL>/admin/viewindexqueue.action page (Content Indexing page >> Queue Contents tab)
        This issue is reproducible should there are a huge number of records in the JOURNALENTRY table and this page is accessed for multiple times.

      Expected Results

      The number of contents fetched and listed in the Queue Contents tab are limited, to prevents such performance issue to occur in Confluence.

      Actual Results

      The below exception is thrown in the catalina.out file, which then followed with an OutOfMemoryError:

      18-Jun-2021 07:24:02.439 WARNING [Catalina-utility-2] org.apache.catalina.valves.StuckThreadDetectionValve.notifyStuckThreadDetected Thread [http-nio-8090-exec-8] (id=[274]) has been active for [76,195] milliseco
      nds (since [6/18/21 7:22 AM]) to serve the same request for [<BaseURL>/admin/viewindexqueue.action] and may be stuck (configured threshold for this StuckThreadDetectionValve is [60] seco
      nds). There is/are [4] thread(s) in total that are monitored by this Valve and may be stuck.
              java.lang.Throwable
                      at java.base@11.0.8/java.util.regex.Pattern$BmpCharPredicate.lambda$union$2(Unknown Source)
                      at java.base@11.0.8/java.util.regex.Pattern$BmpCharPredicate$$Lambda$149/0x0000000800357440.is(Unknown Source)
      ...
                      at com.atlassian.confluence.api.model.journal.JournalIdentifier.<init>(JournalIdentifier.java:36)
                      at com.atlassian.confluence.impl.journal.JournalIdentifierUserType.nullSafeGet(JournalIdentifierUserType.java:39)
      ...
                      at com.atlassian.confluence.impl.journal.DefaultJournalManager.peek(DefaultJournalManager.java:61)
                      at com.atlassian.confluence.impl.journal.DefaultJournalService.peek(DefaultJournalService.java:54)
                      at com.atlassian.confluence.search.queue.AbstractJournalIndexTaskQueue.getQueuedEntries(AbstractJournalIndexTaskQueue.java:83)
                      at com.atlassian.confluence.admin.actions.ViewIndexQueueAction.getQueuedEntries(ViewIndexQueueAction.java:67)
                      at com.atlassian.confluence.admin.actions.ViewIndexQueueAction.getQueue(ViewIndexQueueAction.java:51)
      ...
      java.lang.OutOfMemoryError: Java heap space
      ...
      

      Workaround

      Currently there is no known workaround for this behavior. A workaround will be added here when available

            Assignee:
            Yaroslav Stanislavchuk (Inactive)
            Reporter:
            Lauretha Rura
            Votes:
            0 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: