JIRA re-indexing fails with Error getting the next result (This ResultSet is closed.)
症状
JIRA re-indexing will fail after reaching around 15 minutes or around 80%. The following error is thrown in the UI:
Error stack trace:
org.ofbiz.core.util.GeneralRuntimeException: Error getting the next result (Closed Resultset: next)
at org.ofbiz.core.entity.EntityListIterator.next(EntityListIterator.java:251)
at com.atlassian.jira.ofbiz.DefaultOfBizListIterator.next(DefaultOfBizListIterator.java:136)
at com.atlassian.jira.issue.util.DatabaseIssuesIterator.pullNextIssue(DatabaseIssuesIterator.java:92)
at com.atlassian.jira.issue.util.DatabaseIssuesIterator.populateNextIssueIfNull(DatabaseIssuesIterator.java:56)
at com.atlassian.jira.issue.util.DatabaseIssuesIterator.hasNext(DatabaseIssuesIterator.java:35)
at com.atlassian.jira.util.collect.CollectionUtil.foreach(CollectionUtil.java:41)
at com.atlassian.jira.issue.util.DatabaseIssuesIterable.foreach(DatabaseIssuesIterable.java:43)
at com.atlassian.jira.issue.index.DefaultIssueIndexer.perform(DefaultIssueIndexer.java:242)
atlassian-jira.log
に次のメッセージが表示される。
JiraTaskExecutionThread-4 ERROR xxxx xxxxxxx 297u5a xx.xxx.xx.xx,127.0.0.1 /secure/admin/IndexReIndex!reindex.jspa [c.a.j.util.index.CompositeIndexLifecycleManager] Reindex All FAILED. Indexer: DefaultIndexManager: paths: [/srv/jira/data/caches/indexesV1/comments, /srv/jira/data/caches/indexesV1/issues, /srv/jira/data/caches/indexesV1/changes, /srv/jira/data/caches/indexesV1/worklogs]
org.ofbiz.core.util.GeneralRuntimeException: Error getting the next result (This ResultSet is closed.)
at org.ofbiz.core.entity.EntityListIterator.next(EntityListIterator.java:272)
at com.atlassian.jira.ofbiz.DefaultOfBizListIterator.next(DefaultOfBizListIterator.java:100)
at com.atlassian.jira.ofbiz.WrappingOfBizListIterator.next(WrappingOfBizListIterator.java:68)
at com.atlassian.jira.issue.util.DatabaseIssuesIterator.pullNextIssue(DatabaseIssuesIterator.java:97)
at com.atlassian.jira.issue.util.DatabaseIssuesIterator.populateNextIssueIfNull(DatabaseIssuesIterator.java:68)
at com.atlassian.jira.issue.util.DatabaseIssuesIterator.hasNext(DatabaseIssuesIterator.java:51)
at com.atlassian.jira.issue.util.DatabaseIssuesIterable.foreach(DatabaseIssuesIterable.java:55)
at com.atlassian.jira.issue.index.DefaultIssueIndexer.perform(DefaultIssueIndexer.java:335)
at com.atlassian.jira.issue.index.DefaultIssueIndexer.indexIssuesBatchMode(DefaultIssueIndexer.java:182)
at com.atlassian.jira.issue.index.DefaultIssueIndexer.indexIssuesBatchMode(DefaultIssueIndexer.java:198)
at com.atlassian.jira.issue.index.DefaultIndexManager.doIndexIssuesInBatchMode(DefaultIndexManager.java:1023)
at com.atlassian.jira.issue.index.DefaultIndexManager.doStopTheWorldReindex(DefaultIndexManager.java:1002)
at com.atlassian.jira.issue.index.DefaultIndexManager.lambda$reIndexAll$0(DefaultIndexManager.java:331)
at com.atlassian.jira.issue.index.DefaultIndexManager.withReindexLock(DefaultIndexManager.java:378)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexAll(DefaultIndexManager.java:331)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexAll(DefaultIndexManager.java:264)
... 3 filtered
原因
The main cause of this problem is that something caused Jira to not receive a valid response from the Database. The most common cause of this problem happens when upgrading from Jira 7+ to Jira 8+ (Until 8.14), due to the following reported bug: - JRASERVER-70327Getting issue details... STATUS
Recently this issue can also be found to happen for upgrades from 8.x to 9.x versions and also during full re-index in certain versions above 8.14. This would be accompanied by the log entries that indicate that the pool size has maxed out as explained in the bug.
ソリューション
Solution 1: Upgrade Jira
The bug report has been fixed on versions 8.14+. If your Jira is in a lower version, upgrading to 8.14+ should permanently fix the problem. If upgrade is not an option or you are already on version 8.14+ but the problem still exists, please see Solution 2 below
Solution 2:
If upgrade is not an option or you are already on version 8.14+ but the problem still exists, you can perform the following to mitigate the issue:
Set Maxqueuesize value to 4000
Configure the following parameters within your https://confluence.atlassian.com/jirakb/edit-the-jira-config-properties-file-in-jira-server-317194938.html
jira.index.issue.maxqueuesize=4000 jira.index.sharedentity.maxqueuesize=4000
Restart Jira for the flags to be picked up.
In order to verify if the new values were correctly picked up, a Jira Admin can confirm if they are seen under Administration > System > General Configuration > Advanced Settings.
Ensure pool-max-size value is at least 40
- If your pool-max-size value is below 40, please refer to Tuning database connections and update the value to 40.
- It is recommended to have the
pool-max-size
value at 40 in Jira 8 and 9, as explained in Upgrading Jira Data Center - Pool-max-size.