lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Björn Ekengren <bjorn.ekeng...@avanza.se>
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

/B
  _____  



-----Original Message-----
From: Michael McCandless [mailto:lucene@mikemccandless.com]
Sent: den 26 juli 2006 20:16
To: java-user@lucene.apache.org
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 java.io.File.delete 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...

Mike

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