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

Reopening IndexReader may lead to memory leak

    XMLWordPrintable

Details

    Description

      Summary

      Reopening IndexReader may lead to memory leak and causing additional pressure on JVM this may.

      Error:

      Error while resetting searcher: ISSUE message: this IndexReader is closed
      org.apache.lucene.store.AlreadyClosedException: this IndexReader is closed
      	at org.apache.lucene.index.IndexReader.ensureOpen(IndexReader.java:263)
      

      or this line is present it the logs

      "Tried to reopen the IndexReader, but it threw AlreadyClosedException. Opening a fresh IndexReader."

      Steps to Reproduce

      This is not guaranteed to reproduce the bug.

      1. Run background reindex 
      2. Do many search requests

      Expected Results

      Jira handles reopen of IndexReader gracefully. 

      Actual Results

      After one of the above two errors happen Jira is opening another fresh copy of IndexReader from disk. This result in all Lucene memory caches being duplicated. In most cases those structures occupy several GB or RAM which results in either OutOfMemoryError or memory pressure and full GC events being triggered. 

      Notes

      This is happening because of concurrency bug in com.atlassian.jira.index.DelayCloseable.Helper

      Example of leak in DelayCloseSearcher"

      Workaround

      Restart JIRA

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: