You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Shai Erera <se...@gmail.com> on 2011/05/25 12:00:33 UTC

MockIndexOutputWrapper and maybeThrowDeterministicException()

Hi

While working on LUCENE-3139, I found out that we have a good number of
tests that fail to release resources. I tracked one problem of the above
class not calling delegate.close() if an exception is thrown from
maybeThrow...(), and fixed it.

Other tests seem to suffer from the same illness, in other methods. For
example, TestIndexWriterExceptions.testDocumentsWriterAbort fails to delete
the director too, b/c MockIOWrapper.writeBytes() calls maybeThrow...() and
if indeed something is thrown, the file stays open.

You can simulate that on Windows if you run the test w/
-Dtests.directory=FSDirectory.

I think in order to solve that, we need to try-catch any calls to
maybeThrow. If an exception was indeed thrown, we close() and rethrow it?

Shai

Re: MockIndexOutputWrapper and maybeThrowDeterministicException()

Posted by Michael McCandless <lu...@mikemccandless.com>.
+1

Mike

http://blog.mikemccandless.com

On Wed, May 25, 2011 at 6:00 AM, Shai Erera <se...@gmail.com> wrote:
> Hi
>
> While working on LUCENE-3139, I found out that we have a good number of
> tests that fail to release resources. I tracked one problem of the above
> class not calling delegate.close() if an exception is thrown from
> maybeThrow...(), and fixed it.
>
> Other tests seem to suffer from the same illness, in other methods. For
> example, TestIndexWriterExceptions.testDocumentsWriterAbort fails to delete
> the director too, b/c MockIOWrapper.writeBytes() calls maybeThrow...() and
> if indeed something is thrown, the file stays open.
>
> You can simulate that on Windows if you run the test w/
> -Dtests.directory=FSDirectory.
>
> I think in order to solve that, we need to try-catch any calls to
> maybeThrow. If an exception was indeed thrown, we close() and rethrow it?
>
> Shai
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org