lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Björn Ekengren <>
Subject RE: Lock obtain timed out
Date Thu, 27 Jul 2006 06:59:47 GMT
After some research on addShutdownHook it seems that Eclipse terminates program rather brutally
giving neither finalize nor shutdownhook any chance to run. This is a known bug in Eclipse.
The application I'm writing is a server that keeps a reader and a writer open at all time.
I realized last nigth this will not work since they both need a lock (reader when deleting
and writer when adding) so I need a workaround. Is it possible to temporarily let the reader
release the lock so that the writer can add a document or do I need to close it and open it
again when writer is finished ?

OS: win xp
JVM: 1.5


-----Original Message-----
From: Michael McCandless []
Sent: den 26 juli 2006 20:16
Subject: Re: Lock obtain timed out
Importance: Low

>> When I close my application containing index writers the
>> lock files are left in the temp directory causing an "Lock obtain
>> timed out" error upon the next restart.
> My guess is that you keep a writer open even though there is no activity
> involving adding new documents. Unless I have a massive never ending
> stream of new data arriving (many thousand per minute) I usually try not
> to have an open writer. Opening, adding documents and closing the writer
> in iterations.

It's also odd that you can repeat this so easily.  What OS/platform are 
you using?

The IndexWriter and IndexReader have their own finalizers to release 
(remove) the lock files.

Is it possible your JVM is exiting in a non-graceful manner (ie crashing)?

One known issue is Lucene just calls to remove the 
lock file, but doesn't check/confirm the returned result of this call 
that the file was actually deleted.  We are working on improving the 
locking by using native (OS) locks instead, which should correctly free 
lock files whenever the JVM process exits.  But this won't happen until 
a future Lucene release...


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message