Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-15085

Output streams closed with IOUtils suppressing write errors

VotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 3.1.0, 2.10.0, 2.9.1, 3.0.1
    • None
    • None
    • Reviewed

    Description

      There are a few places in hadoop-common that are closing an output stream with IOUtils.cleanupWithLogger like this:

        try {
          ...write to outStream...
        } finally {
          IOUtils.cleanupWithLogger(LOG, outStream);
        }
      

      This suppresses any IOException that occurs during the close() method which could lead to partial/corrupted output without throwing a corresponding exception. The code should either use try-with-resources or explicitly close the stream within the try block so the exception thrown during close() is properly propagated as exceptions during write operations are.

      Attachments

        1. HADOOP-15085.001.patch
          11 kB
          Jim Brennan
        2. HADOOP-15085.002.patch
          12 kB
          Jim Brennan
        3. HADOOP-15085.003.patch
          11 kB
          Jim Brennan
        4. HADOOP-15085.004.patch
          11 kB
          Jim Brennan
        5. HADOOP-15085.005.patch
          11 kB
          Jim Brennan
        6. HADOOP-15085-branch-2.001.patch
          13 kB
          Jim Brennan
        7. HADOOP-15085-branch-2.002.patch
          13 kB
          Jim Brennan
        8. HADOOP-15085-branch-2.003.patch
          10 kB
          Jim Brennan

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            jbrennan Jim Brennan
            jlowe Jason Darrell Lowe
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment