lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless" <luc...@mikemccandless.com>
Subject Re: Lucene 2.1: java.io.IOException: Lock obtain timed out: SimpleFSLock@<path of index file>
Date Thu, 01 Mar 2007 10:22:25 GMT
"Jerome Chauvin" <Jerome.Chauvin@businessinteractif.fr> wrote:

> We encounter issues while updating the lucene index, here is the stack
> trace:
>  
> Caused by: java.io.IOException: Lock obtain timed out:
> SimpleFSLock@/data/www/orcanta/lucene/store1/write.lock
>  at org.apache.lucene.store.Lock.obtain(Lock.java:69)
>  at
>  org.apache.lucene.index.IndexReader.aquireWriteLock(IndexReader.java:526)
>  at
>  org.apache.lucene.index.IndexReader.deleteDocument(IndexReader.java:551)
>  at
>  org.apache.lucene.index.IndexReader.deleteDocuments(IndexReader.java:578)
>  at
> com.bi.commerce.service.catalog.spring.lucene.LuceneIndex.deleteFromIndex(Luc
> eneIndex.java:692)
>  ... 25 more

First off, you have to ensure only one writer (either IndexWriter or
as in this case IndexReader doing deletes) is trying to update the
index at the same time.  Lucene only allows one writer on an index, and if
a second writer tries to open it will receive exactly this exception.

(Note that as of 2.1 you can now do deletes with IndexWriter which
simplifies things because you can use a single IndexWriter for
adds/updates/deletes.)

If you are already doing that (single writer) correctly, the other
common cause is that this is a leftover lock file (for example if the
JVM crashed or was killed or even if you didn't close a previous
writer before the JVM exited).  There is a better locking
implementation (NativeFSLockFactory) that correctly frees the lock
when the JVM crashes so you may want to use that one instead if you
hit this often (but first explain the root cause of your crashes!).

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message