Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-6120

how should MockIndexOutputWrapper.close handle exceptions in delegate.close

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.0, 6.0
    • Component/s: core/store
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      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...

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mikemccand Michael McCandless
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: