Full re-index is failing with error org.apache.lucene.store.LockObtainFailedException: Lock held by this virtual machine
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
In this article we are going to describe a scenario where Full re-index appears to fail with following error in logs.
1
Caused by: com.atlassian.jira.issue.index.SearchUnavailableException: com.atlassian.jira.util.RuntimeIOException: org.apache.lucene.store.LockObtainFailedException: Lock held by this virtual machine: /var/jira_home/caches/indexesV2/issues/write.lock
Environment
Jira 9.x
Diagnosis
In this scenario Full reindex was run via schedule cron in Kubernetes. Full re-index was scheduled to run every Sunday at 12:00 Midnight.
Also Index snapshot service by default run at 2:00 AM everyday.
Solution
There is a known bug JRASERVER-74524 - Running an index snapshot backup job whilst the index is being restored, breaks the node's index.
A complete re-index typically takes a couple of hours to finish. If the index snapshot service runs at the same time, it can disrupt the node index. It's advisable to schedule a full re-index in such a way that it doesn't conflict with the index snapshot service. In this particular case, the user scheduled a full re-index for 5:00 AM on Sunday so that it runs after the index snapshot service is completed. This resolved the problem.
Was this helpful?