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

Race condition when closing a DelayCloseSearcher

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Low
    • 4.0
    • 4.0 - Beta 2
    • Indexing

    Description

      When closing a searcher, the current DelayCloseSearcher is set to null and then marked as closed. No-one should again use this searcher and it checks to make sure. There is a race condition though where another thread may get access to the searcher reference before it has been nulled and then call open after it has been closed. The following exception is thrown:

       java.lang.IllegalStateException: java.lang.IllegalStateException: closeWhenDone() already called
              at com.atlassian.jira.issue.index.DefaultIndexManager$1.get(DefaultIndexManager.java:86)
              at com.atlassian.jira.issue.index.DefaultIndexManager$1.get(DefaultIndexManager.java:78)
              at com.atlassian.jira.issue.index.SearcherCache.retrieveIssueSearcher(SearcherCache.java:37)
              at com.atlassian.jira.issue.index.DefaultIndexManager.getIssueSearcher(DefaultIndexManager.java:566)
              at sun.reflect.GeneratedMethodAccessor141.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:597)
              at com.atlassian.util.profiling.object.ObjectProfiler.profiledInvoke(ObjectProfiler.java:70)
              at com.atlassian.jira.config.component.SwitchingInvocationHandler.invoke(SwitchingInvocationHandler.java:28)
              at $Proxy67.getIssueSearcher(Unknown Source)
              at com.atlassian.jira.util.searchers.ThreadLocalSearcherCache.getReader(ThreadLocalSearcherCache.java:27)
              at com.atlassian.jira.web.bean.StatisticAccessorBean.searchCountMap(StatisticAccessorBean.java:214)
              ... 140 more
      Caused by: java.lang.IllegalStateException: closeWhenDone() already called
              at com.atlassian.jira.util.dbc.Assertions.stateTrue(Assertions.java:145)
              at com.atlassian.jira.index.DelayCloseable$Helper.open(DelayCloseable.java:69)
              at com.atlassian.jira.index.DelayCloseSearcher.open(DelayCloseSearcher.java:44)
              at com.atlassian.jira.index.DefaultIndexEngine$SearcherReference.doGet(DefaultIndexEngine.java:208)
              at com.atlassian.jira.index.DefaultIndexEngine$SearcherReference.doGet(DefaultIndexEngine.java:179)
              at com.atlassian.jira.index.DefaultIndexEngine$ReferenceHolder.get(DefaultIndexEngine.java:296)
              at com.atlassian.jira.index.DefaultIndexEngine.getSearcher(DefaultIndexEngine.java:136)
              at com.atlassian.jira.index.DefaultManager.getSearcher(DefaultManager.java:39)
              at com.atlassian.jira.issue.index.DefaultIssueIndexer.getIssueSearcher(DefaultIssueIndexer.java:185)
              at com.atlassian.jira.issue.index.DefaultIndexManager$1.get(DefaultIndexManager.java:82)
      

      There should be a mechanism to detect this and retry.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jed Jed Wesley-Smith (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: