From ce5ad0e88f463b22e975f2a480c0a54a56f80c1e Mon Sep 17 00:00:00 2001 From: Mingliang Liu Date: Thu, 15 Dec 2016 15:39:15 -0800 Subject: [PATCH] HDFS-11253. FileInputStream leak on failure path in BlockSender. Contributed by Arpit Agarwal --- .../org/apache/hadoop/hdfs/server/datanode/BlockSender.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockSender.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockSender.java index 0c3c3dc998d..cf59e62d6a5 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockSender.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/BlockSender.java @@ -414,6 +414,8 @@ class BlockSender implements java.io.Closeable { ris = new ReplicaInputStreams(blockIn, checksumIn, volumeRef); } catch (IOException ioe) { IOUtils.closeStream(this); + org.apache.commons.io.IOUtils.closeQuietly(blockIn); + org.apache.commons.io.IOUtils.closeQuietly(checksumIn); throw ioe; } }