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: LockObtainFailedException
Date Mon, 02 Nov 2009 11:11:56 GMT
It's best to arrange w/ Tomcat's shutdown to close any open writers.

But, you can also use IndexWriter.unlock(Directory) to forcefully
remove the lock.  But be very careful: if you accidentally remove a
lock out from under a live IndexWriter, that will quickly lead to
index corruption.

Mike

On Mon, Nov 2, 2009 at 5:20 AM, Chris Bamford <Chris.Bamford@scalix.com> wrote:
> Hi Anshum,
>
> Yes there is a reply, but it is Solr specific :-)
> I understand that I can catch the exception, but then what can I do about it when it
occurs?  In my case I am pretty sure that the 'write.lock' file is stale - most probably
left from the last time Tomcat shut down - so I want to force it to be opened.  How can I
do that?  Am I obliged to locate the file and remove it myself before attempting to repeat
the open() - or is there something in the API to help?
>
> Thanks
>
> - Chris
>
> ----- Original Message -----
> From: Anshum <anshumg@gmail.com>
> Sent: Mon, 11/2/2009 10:08am
> To: java-user@lucene.apache.org
> Subject: Re: LockObtainFailedException
>
> Hi Chris,
>
> Isn't there a reply @ the older thread?
> In case there isn't, this is generally observed when an indexwriter is not
> closed properly i.e. just not closed.
> The lock is created on opening the indexwriter to maintain the sanity of the
> index. This lock gets removed on closing writer.close(). In case of
> exceptions, when the indexwriter.close() is not closed, the subsequent call
> to an index operation (opening a writer) would result in a
> lockobtainfailedexception.
> Try using a finally block to handle such cases.
>
> --
> Anshum Gupta
> Naukri Labs!
> http://ai-cafe.blogspot.com
>
> The facts expressed here belong to everybody, the opinions to me. The
> distinction is yours to draw............
>
>
> On Mon, Nov 2, 2009 at 3:27 PM, Chris Bamford <Chris.Bamford@scalix.com>wrote:
>
>> Hi,
>>
>> I was researching LockObtainFailedExceptions and came across this thread.
>> I
>> don't use Solr, just regular Lucene deployed via Tomcat - but I have
>> started getting these exceptions which coincides with our recent
>> upgrade from 2.0.0 to 2.4.0.
>> I have found that just removing the lock file
>> seems to clear up the problem, but I was hoping for (a) a better
>> understanding of why they might occur in the first place and (b) some
>> thoughts on how I might deal with them programatically.
>>
>> Thanks for any ideas / pointers,
>>
>> - Chris
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
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