Accessing JIRA Issue Results in 'Error Re-indexing Changes for Issue'
Symptoms
When attempting to access a specific issue in a JIRA instance, the request never returns and eventually times out. The following appears in the atlassian-jira.log
:
2010-06-22 12:26:10,840 JiraQuartzScheduler_Worker-1 ERROR [event.listeners.search.IssueIndexListener] Error re-indexing changes for issue 'PRO-499'
com.atlassian.jira.issue.index.IndexException: com.atlassian.bonnie.LuceneException: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@E:\jira_index\issues\write.lock
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssues(DefaultIndexManager.java:299)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssues(DefaultIndexManager.java:252)
at com.atlassian.jira.issue.index.DefaultIndexManager.reIndexIssueObjects(DefaultIndexManager.java:260)
Cause
The above error occurs because there is a problem obtaining a lock on the index when attempting to re-index issue 'PRO-499'. When this error repeats frequently in a short period of time, the indicated issue is likely the problematic issue. It probably has an unreasonable number of comments attached to it.
For example, if an account assigned to an issue in JIRA has its e-mail account removed from the e-mail server, an indefinite e-mail loop can occur between the instance of JIRA and the mail system. If this continues unnoticed for a significant period of time, comments are almost continuously added to said issue and it can cause performance issues when trying to view the affected issue in JIRA. Usually, the request times out before it can be completed.
Resolution
Remove all unnecessary and automated comments from the issue:
Issue the following SQL command to determine the author of the comments:
SELECT a.* FROM jiraaction a, jiraissue i WHERE a.issueid = i.id AND i.pkey = 'PRO-499' GROUP BY author;
The result of this query will indicate which author has contributed the most comments to this issue. This is more than likely the author whose comments were automatically added as a result of an e-mail error / loop.
Execute the following to remove comments by said author (be sure to replace <name of author> with appropriate value):
DELETE FROM jiraaction WHERE actiontype = 'comment' AND author = <name of author> AND issueid IN (SELECT id FROM jiraissue)
- Re-index JIRA.
The previously inaccessible issue should now be accessible.
To mitigate future mailing loops
To prevent loops triggered by e-mail sent from an automated service (e.g. JIRA notification), "bulk" handler parameters should be set for the 'create issue/comment by email' service in JIRA.
To prevent mailing loops triggered by an undeliverable e-mail, appropriate e-mail pre-processing should be implemented. Setup a pre-process filter on the mail server. This will pre-process e-mails delivered to JIRA's listener mailboxes. The pre-process filter will remove 'unwanted' e-mails, including undeliverable failure messages, et cetera.