From c0a903da22c65294b232c7530a6a684ee93daba4 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 4 Mar 2014 21:07:03 +0000 Subject: [PATCH] HDFS-6047 TestPread NPE inside in DFSInputStream hedgedFetchBlockByteRange (stack) git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1574205 13f79535-47bb-0310-9956-ffa450edef68 --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../main/java/org/apache/hadoop/hdfs/DFSInputStream.java | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 7908b9ece2..acd5f15ae8 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -525,6 +525,9 @@ Release 2.4.0 - UNRELEASED HDFS-6040. fix DFSClient issue without libhadoop.so and some other ShortCircuitShm cleanups (cmccabe) + HDFS-6047 TestPread NPE inside in DFSInputStream hedgedFetchBlockByteRange + (stack) + BREAKDOWN OF HDFS-5698 SUBTASKS AND RELATED JIRAS HDFS-5717. Save FSImage header in protobuf. (Haohui Mai via jing9) diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java index 5badb24b0a..3705a2fd4f 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/DFSInputStream.java @@ -1177,8 +1177,11 @@ private void hedgedFetchBlockByteRange(LocatedBlock block, long start, // exception already handled in the call method. getFirstToComplete // will remove the failing future from the list. nothing more to do. } - // We got here if exception. Ignore this node on next go around. - ignored.add(chosenNode.info); + // We got here if exception. Ignore this node on next go around IFF + // we found a chosenNode to hedge read against. + if (chosenNode != null && chosenNode.info != null) { + ignored.add(chosenNode.info); + } } // executed if we get an error from a data node block = getBlockAt(block.getStartOffset(), false);