hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jl...@apache.org
Subject hadoop git commit: MAPREDUCE-7048. Uber AM can crash due to unknown task in statusUpdate. Contr ibuted by Peter Bacsko
Date Mon, 12 Feb 2018 20:48:35 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2.7 6d3cf025e -> 331d384f6


MAPREDUCE-7048. Uber AM can crash due to unknown task in statusUpdate. Contr
ibuted by Peter Bacsko


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/331d384f
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/331d384f
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/331d384f

Branch: refs/heads/branch-2.7
Commit: 331d384f65fff4e5c16ad0a4cf18bb00901fe3ff
Parents: 6d3cf02
Author: Jason Lowe <jlowe@apache.org>
Authored: Mon Feb 12 14:48:16 2018 -0600
Committer: Jason Lowe <jlowe@apache.org>
Committed: Mon Feb 12 14:48:16 2018 -0600

----------------------------------------------------------------------
 hadoop-mapreduce-project/CHANGES.txt            |  3 +
 .../java/org/apache/hadoop/mapred/Task.java     | 17 ++--
 .../java/org/apache/hadoop/mapred/TestTask.java | 84 ++++++++++++++++++++
 3 files changed, 99 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/331d384f/hadoop-mapreduce-project/CHANGES.txt
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/CHANGES.txt b/hadoop-mapreduce-project/CHANGES.txt
index 967f75f..eea864d 100644
--- a/hadoop-mapreduce-project/CHANGES.txt
+++ b/hadoop-mapreduce-project/CHANGES.txt
@@ -21,6 +21,9 @@ Release 2.7.6 - UNRELEASED
     MAPREDUCE-7020. Task timeout in uber mode can crash AM. (Peter Bacsko
     via jlowe)
 
+    MAPREDUCE-7048. Uber AM can crash due to unknown task in statusUpdate.
+    (Peter Bacsko via jlowe)
+
 Release 2.7.5 - 2017-12-14
 
   INCOMPATIBLE CHANGES

http://git-wip-us.apache.org/repos/asf/hadoop/blob/331d384f/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Task.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Task.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Task.java
index e1888fe..670e558 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Task.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/Task.java
@@ -63,6 +63,7 @@ import org.apache.hadoop.mapreduce.lib.reduce.WrappedReducer;
 import org.apache.hadoop.mapreduce.task.ReduceContextImpl;
 import org.apache.hadoop.yarn.util.ResourceCalculatorProcessTree;
 import org.apache.hadoop.net.NetUtils;
+import org.apache.hadoop.util.ExitUtil;
 import org.apache.hadoop.util.Progress;
 import org.apache.hadoop.util.Progressable;
 import org.apache.hadoop.util.ReflectionUtils;
@@ -190,6 +191,7 @@ abstract public class Task implements Writable, Configurable {
   protected SecretKey tokenSecret;
   protected SecretKey shuffleSecret;
   protected GcTimeUpdater gcUpdater;
+  private boolean uberized = false;
 
   ////////////////////////////////////////////
   // Constructors
@@ -737,9 +739,6 @@ abstract public class Task implements Writable, Configurable {
       // get current flag value and reset it as well
       boolean sendProgress = resetProgressFlag();
 
-      boolean uberized = conf.getBoolean("mapreduce.task.uberized",
-          false);
-
       while (!taskDone.get()) {
         synchronized (lock) {
           done = false;
@@ -1116,11 +1115,17 @@ abstract public class Task implements Writable, Configurable {
   public void statusUpdate(TaskUmbilicalProtocol umbilical) 
   throws IOException {
     int retries = MAX_RETRIES;
+
     while (true) {
       try {
         if (!umbilical.statusUpdate(getTaskID(), taskStatus)) {
-          LOG.warn("Parent died.  Exiting "+taskId);
-          System.exit(66);
+          if (uberized) {
+            LOG.warn("Task no longer available: " + taskId);
+            break;
+          } else {
+            LOG.warn("Parent died.  Exiting " + taskId);
+            ExitUtil.terminate(66);
+          }
         }
         taskStatus.clearStatus();
         return;
@@ -1333,6 +1338,8 @@ abstract public class Task implements Writable, Configurable {
         NetUtils.addStaticResolution(name, resolvedName);
       }
     }
+
+    uberized = conf.getBoolean("mapreduce.task.uberized", false);
   }
 
   public Configuration getConf() {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/331d384f/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestTask.java
----------------------------------------------------------------------
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestTask.java
b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestTask.java
new file mode 100644
index 0000000..6bf0601
--- /dev/null
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/test/java/org/apache/hadoop/mapred/TestTask.java
@@ -0,0 +1,84 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.mapred;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.util.ExitUtil;
+import org.apache.hadoop.util.ExitUtil.ExitException;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class TestTask {
+  @Mock
+  private TaskUmbilicalProtocol umbilical;
+
+  private Task task;
+
+  @Before
+  public void setup() {
+    task = new StubTask();
+    ExitUtil.disableSystemExit();
+  }
+
+  @Test
+  public void testStatusUpdateDoesNotExitInUberMode() throws Exception {
+    setupTest(true);
+
+    task.statusUpdate(umbilical);
+  }
+
+  @Test(expected = ExitException.class)
+  public void testStatusUpdateExitsInNonUberMode() throws Exception {
+    setupTest(false);
+
+    task.statusUpdate(umbilical);
+  }
+
+  private void setupTest(boolean uberized)
+      throws IOException, InterruptedException {
+    Configuration conf = new Configuration(false);
+    conf.setBoolean("mapreduce.task.uberized", uberized);
+    task.setConf(conf);
+    // (false, true) to avoid possible infinite loop
+    when(umbilical.statusUpdate(any(TaskAttemptID.class),
+        any(TaskStatus.class))).thenReturn(false, true);
+  }
+
+  public class StubTask extends Task {
+    @Override
+    public void run(JobConf job, TaskUmbilicalProtocol umbilical)
+        throws IOException, ClassNotFoundException, InterruptedException {
+      // nop
+    }
+
+    @Override
+    public boolean isMapTask() {
+      return false;
+    }
+  }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message