lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject Re: lock file race conditions
Date Tue, 01 Nov 2005 19:42:49 GMT

1) how do you simulate the exception?
2) you didn't say you got a lock timeout error, you said you got a
   "couldnt delete the lock file" exception ... is your second test
   forcably trying to unlock the index?
3) are you running this test on a windows machine?
4) can you post your unit test?

If i had to guess...

You probably aren't closing the writer in your first
test (as a result of the exception) so the write lock it has open isn't
being released untill the GC calls the finalize() method on that object.

When the tests run normally, the lag for GC is great enough that the lock
file cannot be removed becuase windows won't let you remove a file that is
open.   When you run in the debugger, the pause because of the breakpoint
gives the JVM a chance to call the finalize method.

: Date: Tue, 01 Nov 2005 14:39:09 -0500
: From: Dan Adams <>
: Reply-To:
: To:
: Subject: lock file race conditions
: I have 2 junit tests. The first opens on index writer and then simulates
: have an IOException get throw when trying to add a document. The test
: that runs after than is just a normal test of the search. After the
: first test completes a lock file is left in /tmp. Now, if I run the test
: suite normally I get a "couldnt delete the lock file" exception from the
: second test. If I run it again and set a breakpoint at the beginning of
: the second test, wait a second, and then let it continue it runs fine.
: What is causing this?
: --
: Dan Adams
: Software Engineer
: Interactive Factory
: ---------------------------------------------------------------------
: To unsubscribe, e-mail:
: For additional commands, e-mail:


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

View raw message