My test case first create an empty disk index folder then feed some doc then do some query.
I purge the index by delete all files in the folder. My unit test has several test cases they use same directory in the disk. But it runs one by one,and I dont think there will be 2 threads use the directory at the same time. You suggestion makes sense. I will try if exception still happen if I only run 1 case or all test cases use different directories. 在 2013-7-25 下午7:38,"Michael McCandless" <luc...@mikemccandless.com>写道: > Can you describe what your test is doing? How do you "purge the > index"? It's best to open IndexWriter with OpenMode.CREATE to purge > (rather than remove the files yourself). > > Lock obtain timed out means another IndexWriter is currently using > that directory. > > > > Mike McCandless > > http://blog.mikemccandless.com > > > On Thu, Jul 25, 2013 at 12:26 AM, Yonghui Zhao <zhaoyong...@gmail.com> > wrote: > > Recently I find my unit test will failed sometimes but no always. I use > > Lucene 4.3.0 > > > > After inverstigation, I found when I try to open a IndexWriter for a disk > > directory. > > > > Some time it will throw this exception: > > > > org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: > > NativeFSLock@/tmp/test-idx/write.lock > > > > The default time out is 1000ms, when I set to 3000ms, seems this > exception > > disappeared. > > But I think 1000ms should be enough, how can it happen. What's the > > recommended number? > > > > > > Some time it will throw another exception which I think is more serious. > > > > read past EOF: SimpleFSIndexInput > > > > Each test will purge the index folder, however this exception will > happen > > sometimes. > > > > I don't know the reason, how can I fix this exception? > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscr...@lucene.apache.org > For additional commands, e-mail: java-user-h...@lucene.apache.org > >