lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Busch (JIRA)" <>
Subject [jira] Updated: (LUCENE-669) finalize()-methods of FSDirectory.FSIndexInput and FSDirectory.FSIndexOutput try to close already closed file
Date Sun, 26 Nov 2006 06:58:20 GMT
     [ ]

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] The handle is invalid.
    [junit] ------------- ---------------- ---------------
    [junit] ------------- Standard Error -----------------
    [junit] The handle is invalid.
    [junit] at Method)
    [junit] at
    [junit] at
    [junit] at org.apache.lucene.index.CompoundFileReader.close(
    [junit] at org.apache.lucene.index.SegmentReader.doClose(
    [junit] at org.apache.lucene.index.IndexReader.close(
    [junit] at org.apache.lucene.index.MultiReader.doClose(
    [junit] at org.apache.lucene.index.IndexReader.close(
    [junit] at
    [junit] at org.apache.lucene.index.TestStressIndexing$
    [junit] ------------- ---------------- ---------------
    [junit] Testcase: testStressIndexAndSearching(org.apache.lucene.index.TestStressIndexing):
    [junit] hit unexpected exception in search2
    [junit] junit.framework.AssertionFailedError: hit unexpected exception in search2
    [junit] at org.apache.lucene.index.TestStressIndexing.runStressTest(
    [junit] at org.apache.lucene.index.TestStressIndexing.testStressIndexAndSearching(
    [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:
>             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:
For more information on JIRA, see:


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

View raw message