[ http://issues.apache.org/jira/browse/LUCENE-669?page=all ]
Michael Busch updated LUCENE-669: --------------------------------- Attachment: FSDirectory_close_file2.patch Since the new testcase TestStressIndexing has been added as part of the lockless commits I see this test failing regularly. In ten runs it failed four times with the following exception: [junit] Testsuite: org.apache.lucene.index.TestStressIndexing [junit] Tests run: 1, Failures: 1, Errors: 0, Time elapsed: 33.338 sec [junit] ------------- Standard Output --------------- [junit] java.io.IOException: The handle is invalid. [junit] ------------- ---------------- --------------- [junit] ------------- Standard Error ----------------- [junit] java.io.IOException: The handle is invalid. [junit] at java.io.RandomAccessFile.close0(Native Method) [junit] at java.io.RandomAccessFile.close(RandomAccessFile.java:573) [junit] at org.apache.lucene.store.FSIndexInput.close(FSDirectory.java:537) [junit] at org.apache.lucene.index.CompoundFileReader.close(CompoundFileReader.java:111) [junit] at org.apache.lucene.index.SegmentReader.doClose(SegmentReader.java:252) [junit] at org.apache.lucene.index.IndexReader.close(IndexReader.java:637) [junit] at org.apache.lucene.index.MultiReader.doClose(MultiReader.java:235) [junit] at org.apache.lucene.index.IndexReader.close(IndexReader.java:637) [junit] at org.apache.lucene.search.IndexSearcher.close(IndexSearcher.java:74) [junit] at org.apache.lucene.index.TestStressIndexing$SearcherThread.run(TestStressIndexing.java:101) [junit] ------------- ---------------- --------------- [junit] Testcase: testStressIndexAndSearching(org.apache.lucene.index.TestStressIndexing): FAILED [junit] hit unexpected exception in search2 [junit] junit.framework.AssertionFailedError: hit unexpected exception in search2 [junit] at org.apache.lucene.index.TestStressIndexing.runStressTest(TestStressIndexing.java:140) [junit] at org.apache.lucene.index.TestStressIndexing.testStressIndexAndSearching(TestStressIndexing.java:161) [junit] Test org.apache.lucene.index.TestStressIndexing FAILED It appears to be the same problem for which I opened this issue. After applying the patch I did not see the test failing anymore (I ran it about 20 times...) I attach a new version of this patch. Now FSDirectory.FSIndexOutput.finalize() simply calls close() which triggers a flush of the buffer. I don't see a reason not do that. Anybody does? All unit tests pass with the new patch. > finalize()-methods of FSDirectory.FSIndexInput and FSDirectory.FSIndexOutput > try to close already closed file > ------------------------------------------------------------------------------------------------------------- > > Key: LUCENE-669 > URL: http://issues.apache.org/jira/browse/LUCENE-669 > Project: Lucene - Java > Issue Type: Bug > Components: Store > Reporter: Michael Busch > Assigned To: Michael Busch > Priority: Trivial > Attachments: FSDirectory_close_file2.patch > > > Hi all, > I found a small problem in FSDirectory: The finalize()-methods of > FSDirectory.FSIndexInput and FSDirectory.FSIndexOutput try to close the > underlying file. This is not a problem unless the file has been closed before > by calling the close() method. If it has been closed before, the finalize > method throws an IOException saying that the file is already closed. Usually > this IOException would go unnoticed, because the GarbageCollector, which > calls finalize(), just eats it. However, if I use the Eclipse debugger the > execution of my code will always be suspended when this exception is thrown. > Even though this exception probably won't cause problems during normal > execution of Lucene, the code becomes cleaner if we apply this small patch. > Might this IOException also have a performance impact, if it is thrown very > frequently? > I attached the patch which applies cleanly on the current svn HEAD. All > testcases pass and I verfied with the Eclipse debugger that the IOException > is not longer thrown. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]