Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Lucene: Java-User

LockObtainFailedException

 

 

Lucene java-user RSS feed   Index | Next | Previous | View Threaded


Chris.Bamford at scalix

Nov 2, 2009, 1:57 AM

Post #1 of 5 (994 views)
Permalink
LockObtainFailedException

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


anshumg at gmail

Nov 2, 2009, 2:08 AM

Post #2 of 5 (944 views)
Permalink
Re: LockObtainFailedException [In reply to]

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 [at] scalix>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
>


Chris.Bamford at scalix

Nov 2, 2009, 2:20 AM

Post #3 of 5 (936 views)
Permalink
RE: LockObtainFailedException [In reply to]

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 [at] gmail>
Sent: Mon, 11/2/2009 10:08am
To: java-user [at] lucene
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 [at] scalix>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 [at] lucene
For additional commands, e-mail: java-user-help [at] lucene


anshumg at gmail

Nov 2, 2009, 2:34 AM

Post #4 of 5 (933 views)
Permalink
Re: LockObtainFailedException [In reply to]

Is that a part of some regular process? as in the tomcat shutdown? if it is,
could you pass a shutdown signal to the search daemon/service and then get
it to close the already opened writers.
Also if its the service that causes the exception, add a writer.close
statement to the finally block (add that if that's not already in place).
That should solve the problem.

--
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:50 PM, Chris Bamford <Chris.Bamford [at] scalix>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 [at] gmail>
> Sent: Mon, 11/2/2009 10:08am
> To: java-user [at] lucene
> 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 [at] scalix
> >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 [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>


lucene at mikemccandless

Nov 2, 2009, 3:11 AM

Post #5 of 5 (935 views)
Permalink
Re: LockObtainFailedException [In reply to]

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 [at] scalix> 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 [at] gmail>
> Sent: Mon, 11/2/2009 10:08am
> To: java-user [at] lucene
> 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 [at] scalix>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 [at] lucene
> For additional commands, e-mail: java-user-help [at] lucene
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe [at] lucene
For additional commands, e-mail: java-user-help [at] lucene

Lucene java-user RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.