java.lang.IllegalStateException: java.lang.IllegalStateException: closeWhenDone() already called

Atlassian JIRA | Jed Wesley-Smith | 8 years ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.
  1. 0

    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: {noformat} 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) {noformat} There should be a mechanism to detect this and retry.

    Atlassian JIRA | 8 years ago | Jed Wesley-Smith
    java.lang.IllegalStateException: java.lang.IllegalStateException: closeWhenDone() already called
  2. 0

    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: {noformat} 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) {noformat} There should be a mechanism to detect this and retry.

    Atlassian JIRA | 8 years ago | Jed Wesley-Smith
    java.lang.IllegalStateException: java.lang.IllegalStateException: closeWhenDone() already called

    Root Cause Analysis

    1. java.lang.IllegalStateException

      closeWhenDone() already called

      at com.atlassian.jira.util.dbc.Assertions.stateTrue()
    2. com.atlassian.jira
      DefaultIndexManager$1.get
      1. com.atlassian.jira.util.dbc.Assertions.stateTrue(Assertions.java:145)
      2. com.atlassian.jira.index.DelayCloseable$Helper.open(DelayCloseable.java:69)
      3. com.atlassian.jira.index.DelayCloseSearcher.open(DelayCloseSearcher.java:44)
      4. com.atlassian.jira.index.DefaultIndexEngine$SearcherReference.doGet(DefaultIndexEngine.java:208)
      5. com.atlassian.jira.index.DefaultIndexEngine$SearcherReference.doGet(DefaultIndexEngine.java:179)
      6. com.atlassian.jira.index.DefaultIndexEngine$ReferenceHolder.get(DefaultIndexEngine.java:296)
      7. com.atlassian.jira.index.DefaultIndexEngine.getSearcher(DefaultIndexEngine.java:136)
      8. com.atlassian.jira.index.DefaultManager.getSearcher(DefaultManager.java:39)
      9. com.atlassian.jira.issue.index.DefaultIssueIndexer.getIssueSearcher(DefaultIssueIndexer.java:185)
      10. com.atlassian.jira.issue.index.DefaultIndexManager$1.get(DefaultIndexManager.java:82)
      10 frames