You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Robert Muir (JIRA)" <ji...@apache.org> on 2014/12/17 17:32:13 UTC

[jira] [Commented] (LUCENE-6120) how should MockIndexOutputWrapper.close handle exceptions in delegate.close

    [ https://issues.apache.org/jira/browse/LUCENE-6120?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14250079#comment-14250079 ] 

Robert Muir commented on LUCENE-6120:
-------------------------------------

this is a test bug, but there are more bugs here in addition to this one.

if close() is called multiple times, then disk usage computation and internal ref counting (trace through removeIndexOutput()) is wrong. that violates Closeable.close()


> how should MockIndexOutputWrapper.close handle exceptions in delegate.close
> ---------------------------------------------------------------------------
>
>                 Key: LUCENE-6120
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6120
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/store
>            Reporter: Michael McCandless
>            Priority: Minor
>
> Chasing a tricking Elasticsearch test failure, it came down to the delegate.close throwing an exception (ClosedByInterruptException, disturbingly, in this case), causing MockIndexOutputWrapper.close to fail to remove that IO from MDW's map.
> The question is, what should we do here, when delegate.close throws an exception?  Is the delegate in fact closed, even when it throws an exception?  
> Java8's docs on java.io.Closeable say this:
> As noted in AutoCloseable.close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.
> And our OutputStreamIndexOutput is careful about this (flushes, then closes in a try-with-resources).
> So, I think MDW should be fixed to mark the IO as closed even if delegate.close throws an exception...



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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