com.atlassian.bonnie.LuceneException Couldn't open writer on directory

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

Symptoms

  1. Confluence dashboard is not updated.

  2. Spaces and pages cannot be created.

  3. Removing space took a long time to finished

  4. All the above symptoms still occurs even after How to Rebuild the Content Indexes From Scratch on Unclustered Confluence.

This issue can also cause Confluence to fail to startup entirely, so if Hercules points you to this document and Confluence is completely locked up this could be your issue.

Diagnosis

The following appears in the atlassian-confluence.log:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2011-07-26 16:54:12,068 ERROR [pool-10-thread-1] [ext.usage.event.UsageTaskQueue] run Error indexing task: UsageEventWrapperTask: view:page(1376415) at Tue Jul 26 16:54:11 CEST 2011: com.atlassian.bonnie.LuceneException: Couldn't open writer on directory: org.apache.lucene.store.SimpleFSDirectory@D:\confluence-home\index\plugin\usage lockFactory=org.apache.lucene.store.SimpleFSLockFactory@14c0a13 -- url: /display/GL/Home | userName: aabvh05151 | action: viewpage | page: 1376415 com.atlassian.bonnie.LuceneException: Couldn't open writer on directory: org.apache.lucene.store.SimpleFSDirectory@D:\confluence-home\index\plugin\usage lockFactory=org.apache.lucene.store.SimpleFSLockFactory@14c0a13 at com.atlassian.bonnie.LuceneConnection.withWriter(LuceneConnection.java:346) at com.atlassian.confluence.ext.usage.index.UsageIndexManager.index(UsageIndexManager.java:219) at com.atlassian.confluence.ext.usage.event.UsageTaskQueue$2.run(UsageTaskQueue.java:47) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303) at java.util.concurrent.FutureTask.run(FutureTask.java:138) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:619) Caused by: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@D:\confluence-home\index\plugin\usage\write.lock at org.apache.lucene.store.Lock.obtain(Lock.java:85) at org.apache.lucene.index.IndexWriter.init(IndexWriter.java:1562) at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1118) at com.atlassian.bonnie.LuceneConnection.withWriter(LuceneConnection.java:327) ... 8 more

Creating a space generates the following stack trace:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Cause com.atlassian.bonnie.LuceneException: com.atlassian.bonnie.LuceneException: Couldn't open writer on directory: org.apache.lucene.store.SimpleFSDirectory@/data/confluence/home/index lockFactory=org.apache.lucene.store.SimpleFSLockFactory@d7bcfb8 at com.atlassian.bonnie.LuceneConnection.withBatchUpdate(LuceneConnection.java:409) caused by: com.atlassian.bonnie.LuceneException: Couldn't open writer on directory: org.apache.lucene.store.SimpleFSDirectory@/data/confluence/home/index lockFactory=org.apache.lucene.store.SimpleFSLockFactory@d7bcfb8 at com.atlassian.bonnie.LuceneConnection.withWriter(LuceneConnection.java:346) caused by: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@/data/confluence/home/index/write.lock at org.apache.lucene.store.Lock.obtain(Lock.java:85) Stack Trace:[hide] com.atlassian.bonnie.LuceneException: com.atlassian.bonnie.LuceneException: Couldn't open writer on directory: org.apache.lucene.store.SimpleFSDirectory@/data/confluence/home/index lockFactory=org.apache.lucene.store.SimpleFSLockFactory@d7bcfb8 at com.atlassian.bonnie.LuceneConnection.withBatchUpdate(LuceneConnection.java:409) at com.atlassian.confluence.search.lucene.DefaultConfluenceIndexManager.processTasks(DefaultConfluenceIndexManager.java:161) at com.atlassian.confluence.search.lucene.DefaultConfluenceIndexManager.flushQueue(DefaultConfluenceIndexManager.java:128) at sun.reflect.GeneratedMethodAccessor744.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) ... Caused by: com.atlassian.bonnie.LuceneException: Couldn't open writer on directory: org.apache.lucene.store.SimpleFSDirectory@/data/confluence/home/index lockFactory=org.apache.lucene.store.SimpleFSLockFactory@d7bcfb8 at com.atlassian.bonnie.LuceneConnection.withWriter(LuceneConnection.java:346) at com.atlassian.confluence.search.lucene.tasks.LuceneConnectionBackedIndexTaskPerformer.perform(LuceneConnectionBackedIndexTaskPerformer.java:20) at com.atlassian.confluence.search.lucene.DefaultConfluenceIndexManager$BatchUpdateAction.perform(DefaultConfluenceIndexManager.java:361) at com.atlassian.bonnie.LuceneConnection.withBatchUpdate(LuceneConnection.java:405) ... 208 more Caused by: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: SimpleFSLock@/data/confluence/home/index/write.lock at org.apache.lucene.store.Lock.obtain(Lock.java:85) at org.apache.lucene.index.IndexWriter.init(IndexWriter.java:1562) at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1118) at com.atlassian.bonnie.LuceneConnection.withWriter(LuceneConnection.java:327) ... 211 more

Cause

Lucene fails to acquire a write lock a directory for writing its indices. Also, it may caused by insufficient disk space. One of the contributors to this is scheduled daily backup, which can turn out to be large.

Solution

Workaround

Delete write.lock from <confluence-home>/index/. This issue is tracked here: CONF-22981. Also, check if your Confluence home directory has a sufficient disk space.

Updated on April 2, 2025

Still need help?

The Atlassian Community is here for you.