You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by ss...@apache.org on 2015/02/12 08:27:57 UTC

[11/12] tez git commit: TEZ-2082. Race condition in TaskAttemptListenerImpTezDag.getTask() (bikas)

TEZ-2082. Race condition in TaskAttemptListenerImpTezDag.getTask() (bikas)


Project: http://git-wip-us.apache.org/repos/asf/tez/repo
Commit: http://git-wip-us.apache.org/repos/asf/tez/commit/54bd104e
Tree: http://git-wip-us.apache.org/repos/asf/tez/tree/54bd104e
Diff: http://git-wip-us.apache.org/repos/asf/tez/diff/54bd104e

Branch: refs/heads/TEZ-2003
Commit: 54bd104e841feb7103ba2d3396ce2bd83c8a74ea
Parents: 23fb996
Author: Bikas Saha <bi...@apache.org>
Authored: Wed Feb 11 18:52:28 2015 -0800
Committer: Bikas Saha <bi...@apache.org>
Committed: Wed Feb 11 18:52:28 2015 -0800

----------------------------------------------------------------------
 CHANGES.txt                                       |  1 +
 .../tez/dag/app/TaskAttemptListenerImpTezDag.java | 18 ++++++++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/54bd104e/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index b0127d6..9f4b878 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -7,6 +7,7 @@ Release 0.7.0: Unreleased
 INCOMPATIBLE CHANGES
 
 ALL CHANGES:
+  TEZ-2082. Race condition in TaskAttemptListenerImpTezDag.getTask()
   TEZ-1233. Allow configuration of framework parameters per vertex.
   TEZ-2045. TaskAttemptListener should not pull Tasks from AMContainer. Instead these should be registered with the listener.
   TEZ-1914. VertexManager logic should not run on the central dispatcher

http://git-wip-us.apache.org/repos/asf/tez/blob/54bd104e/tez-dag/src/main/java/org/apache/tez/dag/app/TaskAttemptListenerImpTezDag.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/dag/app/TaskAttemptListenerImpTezDag.java b/tez-dag/src/main/java/org/apache/tez/dag/app/TaskAttemptListenerImpTezDag.java
index 28f2c32..d8e24c0 100644
--- a/tez-dag/src/main/java/org/apache/tez/dag/app/TaskAttemptListenerImpTezDag.java
+++ b/tez-dag/src/main/java/org/apache/tez/dag/app/TaskAttemptListenerImpTezDag.java
@@ -62,6 +62,7 @@ import org.apache.tez.runtime.api.impl.TezHeartbeatRequest;
 import org.apache.tez.runtime.api.impl.TezHeartbeatResponse;
 import org.apache.tez.common.security.JobTokenSecretManager;
 
+import com.google.common.base.Preconditions;
 import com.google.common.collect.Maps;
 
 @SuppressWarnings("unchecked")
@@ -218,13 +219,18 @@ public class TaskAttemptListenerImpTezDag extends AbstractService implements
           if (LOG.isDebugEnabled()) {
             LOG.debug("No task current assigned to Container with id: " + containerId);
           }
+        } else if (task == TASK_FOR_INVALID_JVM) { 
+          LOG.info("Container with id: " + containerId
+              + " is valid, but no longer registered, and will be killed. Race condition.");          
         } else {
-            context.getEventHandler().handle(
-                new TaskAttemptEventStartedRemotely(task.getTaskSpec()
-                    .getTaskAttemptID(), containerId, context
-                    .getApplicationACLs()));
-            LOG.info("Container with id: " + containerId + " given task: "
-                + task.getTaskSpec().getTaskAttemptID());
+          Preconditions.checkState(task != null && task != TASK_FOR_INVALID_JVM, "CId: "
+              + containerId);
+          context.getEventHandler().handle(
+              new TaskAttemptEventStartedRemotely(task.getTaskSpec()
+                  .getTaskAttemptID(), containerId, context
+                  .getApplicationACLs()));
+          LOG.info("Container with id: " + containerId + " given task: "
+              + task.getTaskSpec().getTaskAttemptID());
         }
       }
     }