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

Output streams closed with IOUtils suppressing write errors

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.1.0, 2.10.0, 2.9.1, 3.0.1
    • Component/s: None
    • Labels:
      None
    • Hadoop Flags:
      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

            People

            • Assignee:
              Jim_Brennan Jim Brennan
              Reporter:
              jlowe Jason Lowe
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: