From c2f908482f297fc43c153d528b9e320349fd2104 Mon Sep 17 00:00:00 2001 From: Takanobu Asanuma Date: Mon, 15 Jun 2020 09:15:53 +0900 Subject: [PATCH] HDFS-15403. NPE in FileIoProvider#transferToSocketFully. Contributed by hemanthboyina. (cherry picked from commit f41a144077fc0e2d32072e0d088c1abd1897cee5) --- .../apache/hadoop/hdfs/server/datanode/FileIoProvider.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/FileIoProvider.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/FileIoProvider.java index cb2309d629d..1bdb8aa6a3e 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/FileIoProvider.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/FileIoProvider.java @@ -282,7 +282,12 @@ public class FileIoProvider { profilingEventHook.afterFileIo(volume, TRANSFER, begin, count); } catch (Exception e) { String em = e.getMessage(); - if (!em.startsWith("Broken pipe") && !em.startsWith("Connection reset")) { + if (em != null) { + if (!em.startsWith("Broken pipe") + && !em.startsWith("Connection reset")) { + onFailure(volume, begin); + } + } else { onFailure(volume, begin); } throw e;