Details
Description
There are a few places in HDFS code 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
Attachments
Issue Links
- is duplicated by
-
HDFS-12924 Port HDFS-12881 to branch-2 (Output streams closed with IOUtils suppressing write errors)
- Resolved
- relates to
-
HDFS-12903 [READ] Fix closing streams in ImageWriter
- Resolved