From 3b8418250f8db24cff77b1dfabd83876d28fe0b3 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 fc98d3a6b7a..cf6902912f6 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 @@ -280,7 +280,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;