You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tez.apache.org by bi...@apache.org on 2014/10/01 02:44:49 UTC

git commit: TEZ-1621. Should report error to AM before shuting down TezChild (Jeff Zhang via bikas)

Repository: tez
Updated Branches:
  refs/heads/master 08bafa987 -> 7ebe629f6


TEZ-1621. Should report error to AM before shuting down TezChild (Jeff Zhang via bikas)


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

Branch: refs/heads/master
Commit: 7ebe629f623072a56d48d1ad345bf762211d972c
Parents: 08bafa9
Author: Bikas Saha <bi...@apache.org>
Authored: Tue Sep 30 17:44:36 2014 -0700
Committer: Bikas Saha <bi...@apache.org>
Committed: Tue Sep 30 17:44:36 2014 -0700

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../apache/tez/runtime/task/TezTaskRunner.java  | 29 ++++++++------------
 .../tez/test/TestExceptionPropagation.java      | 20 +++++++++-----
 3 files changed, 26 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tez/blob/7ebe629f/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 618ae3b..38a415a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -13,6 +13,7 @@ INCOMPATIBLE CHANGES
 
 ALL CHANGES:
   TEZ-1620. Wait for application finish before stopping MiniTezCluster
+  TEZ-1621. Should report error to AM before shuting down TezChild
 
 Release 0.5.1: Unreleased
 

http://git-wip-us.apache.org/repos/asf/tez/blob/7ebe629f/tez-dag/src/main/java/org/apache/tez/runtime/task/TezTaskRunner.java
----------------------------------------------------------------------
diff --git a/tez-dag/src/main/java/org/apache/tez/runtime/task/TezTaskRunner.java b/tez-dag/src/main/java/org/apache/tez/runtime/task/TezTaskRunner.java
index c87e2ce..3b251ca 100644
--- a/tez-dag/src/main/java/org/apache/tez/runtime/task/TezTaskRunner.java
+++ b/tez-dag/src/main/java/org/apache/tez/runtime/task/TezTaskRunner.java
@@ -118,11 +118,9 @@ public class TezTaskRunner implements TezUmbilical, ErrorReporter {
         // Not immediately fatal, this is an error reported by Hadoop FileSystem
         failureCause = cause;
       } else if (cause instanceof Error) {
-        LOG.error("Exception of type Error. Exiting now", cause);
-        ExitUtil.terminate(-1, cause);
-        // Effectively dead code. Must return something.
-        assert(false);
-        return false;
+        LOG.error("Exception of type Error.", cause);
+        sendFailure(cause, "Fatal Error cause TezChild exit.");
+        throw new TezException("Fatal Error cause TezChild exit.", cause);
       } else {
         failureCause = cause;
       }
@@ -140,11 +138,9 @@ public class TezTaskRunner implements TezUmbilical, ErrorReporter {
             failureCause);
         throw (FSError) failureCause;
       } else if (failureCause instanceof Error) {
-        LOG.error("Exception of type Error. Exiting now", failureCause);
-        ExitUtil.terminate(-1, failureCause);
-        // Effectively dead code. Must return something.
-        assert(false);
-        return false;
+        LOG.error("Exception of type Error.", failureCause);
+        sendFailure(failureCause, "Fatal error cause TezChild exit.");
+        throw new TezException("Fatal error cause TezChild exit.", failureCause);
       } else {
         if (failureCause instanceof IOException) {
           throw (IOException) failureCause;
@@ -214,8 +210,9 @@ public class TezTaskRunner implements TezUmbilical, ErrorReporter {
                 }
                 throw (FSError) cause;
               } else if (cause instanceof Error) {
-                LOG.error("Exception of type Error. Exiting now", cause);
-                ExitUtil.terminate(-1, cause);
+                LOG.error("Exception of type Error.", cause);
+                sendFailure(cause, "Fatal Error cause TezChild exit.");
+                throw new TezException("Fatal Error cause TezChild exit.", cause);
               } else {
                 if (cause instanceof UndeclaredThrowableException) {
                   cause = ((UndeclaredThrowableException) cause).getCause();
@@ -242,7 +239,6 @@ public class TezTaskRunner implements TezUmbilical, ErrorReporter {
             } finally {
               task.cleanup();
             }
-            return null;
           }
         });
       } finally {
@@ -251,6 +247,8 @@ public class TezTaskRunner implements TezUmbilical, ErrorReporter {
     }
   }
 
+  // should wait until all messages are sent to AM before TezChild shutdown
+  // if this method become async in future
   private void sendFailure(Throwable t, String message) throws IOException, TezException {
     if (!fatalErrorSent.getAndSet(true)) {
       task.setFatalError(t, message);
@@ -331,10 +329,7 @@ public class TezTaskRunner implements TezUmbilical, ErrorReporter {
 
   @Override
   public synchronized void reportError(Throwable t) {
-    if (t instanceof Error) {
-      LOG.error("Exception of type Error during heartbeat, Exiting Now");
-      ExitUtil.terminate(-1, t);
-    } else if (taskRunning.get()) {
+   if (taskRunning.get()) {
       LOG.error("TaskReporter reported error", t);
       maybeRegisterFirstException(t);
       waitingThread.interrupt();

http://git-wip-us.apache.org/repos/asf/tez/blob/7ebe629f/tez-tests/src/test/java/org/apache/tez/test/TestExceptionPropagation.java
----------------------------------------------------------------------
diff --git a/tez-tests/src/test/java/org/apache/tez/test/TestExceptionPropagation.java b/tez-tests/src/test/java/org/apache/tez/test/TestExceptionPropagation.java
index 454f603..38d5998 100644
--- a/tez-tests/src/test/java/org/apache/tez/test/TestExceptionPropagation.java
+++ b/tez-tests/src/test/java/org/apache/tez/test/TestExceptionPropagation.java
@@ -278,8 +278,8 @@ public class TestExceptionPropagation {
     OUTPUT_CLOSE, OUTPUT_INITIALIZE,
     // Not Supported yet
     // PROCESSOR_HANDLE_EVENTS
-    PROCESSOR_RUN, PROCESSOR_CLOSE, PROCESSOR_INITIALIZE,
-
+    PROCESSOR_RUN_ERROR, PROCESSOR_CLOSE_ERROR, PROCESSOR_INITIALIZE_ERROR,
+    PROCESSOR_RUN_EXCEPTION, PROCESSOR_CLOSE_EXCEPTION, PROCESSOR_INITIALIZE_EXCEPTION,
   }
 
   /**
@@ -479,7 +479,9 @@ public class TestExceptionPropagation {
       output.start();
       output.getWriter();
 
-      if (this.exLocation == ExceptionLocation.PROCESSOR_RUN) {
+      if (this.exLocation == ExceptionLocation.PROCESSOR_RUN_ERROR) {
+        throw new Error(this.exLocation.name());
+      } else if (this.exLocation == ExceptionLocation.PROCESSOR_RUN_EXCEPTION) {
         throw new Exception(this.exLocation.name());
       }
     }
@@ -490,15 +492,19 @@ public class TestExceptionPropagation {
 
     @Override
     public void close() throws Exception {
-      if (this.exLocation == ExceptionLocation.PROCESSOR_CLOSE) {
-        throw new RuntimeException(this.exLocation.name());
+      if (this.exLocation == ExceptionLocation.PROCESSOR_CLOSE_ERROR) {
+        throw new Error(this.exLocation.name());
+      } else if (this.exLocation == ExceptionLocation.PROCESSOR_CLOSE_EXCEPTION) {
+        throw new Exception(this.exLocation.name());
       }
     }
 
     @Override
     public void initialize() throws Exception {
-      if (this.exLocation == ExceptionLocation.PROCESSOR_INITIALIZE) {
-        throw new RuntimeException(this.exLocation.name());
+      if (this.exLocation == ExceptionLocation.PROCESSOR_INITIALIZE_ERROR) {
+        throw new Error(this.exLocation.name());
+      } else if (this.exLocation == ExceptionLocation.PROCESSOR_INITIALIZE_EXCEPTION) {
+        throw new Exception(this.exLocation.name());
       }
     }