From 386e62ace38502399500aabf70325892eb179ee5 Mon Sep 17 00:00:00 2001 From: Jason Lowe Date: Wed, 18 Feb 2015 19:28:02 +0000 Subject: [PATCH] MAPREDUCE-6261. NullPointerException if MapOutputBuffer.flush invoked twice. Contributed by Tsuyoshi OZAWA (cherry picked from commit 4981d082d4f3c82d1c2c900c7488b83bf20301cc) --- hadoop-mapreduce-project/CHANGES.txt | 3 +++ .../src/main/java/org/apache/hadoop/mapred/MapTask.java | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt index 1332cd76a58..79c14ca7dcd 100644 --- a/hadoop-mapreduce-project/CHANGES.txt +++ b/hadoop-mapreduce-project/CHANGES.txt @@ -137,6 +137,9 @@ Release 2.7.0 - UNRELEASED MAPREDUCE-4286. TestClientProtocolProviderImpls passes on failure conditions. (Devaraj K via ozawa) + MAPREDUCE-6261. NullPointerException if MapOutputBuffer.flush invoked + twice (Tsuyoshi OZAWA via jlowe) + Release 2.6.1 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/MapTask.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/MapTask.java index 1a4901b257d..80943178298 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/MapTask.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/MapTask.java @@ -1458,6 +1458,10 @@ public class MapTask extends Task { public void flush() throws IOException, ClassNotFoundException, InterruptedException { LOG.info("Starting flush of map output"); + if (kvbuffer == null) { + LOG.info("kvbuffer is null. Skipping flush."); + return; + } spillLock.lock(); try { while (spillInProgress) {