Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Caused by: org.apache.solr.common.SolrException: Index locked for write for core

Tags:

solr

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
like image 688
Cool Techie Avatar asked Jul 03 '13 09:07

Cool Techie


4 Answers

Delete file write.lock in folder /data/index/ for your core then restart tomcat. It will work.

like image 186
Hieu Le Avatar answered Nov 07 '22 11:11

Hieu Le


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 ]

like image 19
Jayendra Avatar answered Nov 07 '22 10:11

Jayendra


If you are using Rails,

just add into solr.xml this line

<lockType>simple</lockType>

its works for me)

like image 1
Evseev Vadim Avatar answered Nov 07 '22 09:11

Evseev Vadim


In some times this occurs because current user dont have permission in directory. Try using root and using -force for start solr.

like image 1
Carlos Eduardo Cabral Avatar answered Nov 07 '22 09:11

Carlos Eduardo Cabral