We are using solr4.3 with master/slave setup, today I got the following error and solr stopped responding. What could be causing this,
Caused by: org.apache.solr.common.SolrException: Index locked for write for core XXX
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:821)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:618)
at org.apache.solr.core.CoreContainer.createFromLocal(CoreContainer.java:949)
at org.apache.solr.core.CoreContainer.create(CoreContainer.java:984)
at org.apache.solr.core.CoreContainer$2.call(CoreContainer.java:597)
at org.apache.solr.core.CoreContainer$2.call(CoreContainer.java:592)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
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)
... 1 more
Caused by: org.apache.lucene.store.LockObtainFailedException: Index locked for write for core XX at org.apache.solr.core.SolrCore.initIndex(SolrCore.java:484)
at org.apache.solr.core.SolrCore.<init>(SolrCore.java:745)
... 13 more
Delete file write.lock
in folder /data/index/
for your core then restart tomcat. It will work.
It seems the index has been locked during indexing.
Usually there would be a write.lock file within the index which needs to be removed to get it back.
The conditions can occur if the indexing breaks in between or other issues which may cause to lock file to be still in the index.
Check Forum
The write lock is due to the fact that an IndexWriter is always open in Solr even on the slaves.
Check for the Index Lock options which can handle the condition within configuration.
[An archived copy of the original link: https://web.archive.org/web/http://docs.lucidworks.com/display/solr/IndexConfig+in+SolrConfig ]
If you are using Rails,
just add into solr.xml this line
<lockType>simple</lockType>
its works for me)
In some times this occurs because current user dont have permission in directory. Try using root and using -force for start solr.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With