You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by cu...@apache.org on 2006/10/03 23:56:41 UTC

svn commit: r452645 - in /lucene/hadoop/trunk: CHANGES.txt src/java/org/apache/hadoop/mapred/TaskTracker.java

Author: cutting
Date: Tue Oct  3 14:56:40 2006
New Revision: 452645

URL: http://svn.apache.org/viewvc?view=rev&rev=452645
Log:
HADOOP-568.  Fix so that errors while initializing tasks mark the task failed.  Contributed by Owen.

Modified:
    lucene/hadoop/trunk/CHANGES.txt
    lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java

Modified: lucene/hadoop/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/CHANGES.txt?view=diff&rev=452645&r1=452644&r2=452645
==============================================================================
--- lucene/hadoop/trunk/CHANGES.txt (original)
+++ lucene/hadoop/trunk/CHANGES.txt Tue Oct  3 14:56:40 2006
@@ -124,6 +124,10 @@
     version' comand is added to show this information, and it is also
     added to various web interfaces.  (omalley via cutting)
 
+30. HADOOP-568.  Fix so that errors while initializing tasks on a
+    tasktracker correctly report the task as failed to the jobtracker,
+    so that it will be rescheduled.  (omalley via cutting)
+
 
 Release 0.6.2 - 2006-09-18
 

Modified: lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java
URL: http://svn.apache.org/viewvc/lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java?view=diff&rev=452645&r1=452644&r2=452645
==============================================================================
--- lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java (original)
+++ lucene/hadoop/trunk/src/java/org/apache/hadoop/mapred/TaskTracker.java Tue Oct  3 14:56:40 2006
@@ -674,10 +674,19 @@
           reduceTotal++;
         }
       }
-      try{
+      try {
     	  localizeJob(tip);
-      }catch(IOException ie){
-    	  LOG.warn("Error initializing Job " + tip.getTask().getJobId());
+      } catch (IOException ie) {
+        String msg = ("Error initializing " + tip.getTask().getTaskId() + 
+                      ":\n" + StringUtils.stringifyException(ie));
+        LOG.warn(msg);
+        tip.reportDiagnosticInfo(msg);
+        try {
+          tip.killAndCleanup(true);
+        } catch (IOException ie2) {
+          LOG.info("Error cleaning up " + tip.getTask().getTaskId() + ":\n" +
+                   StringUtils.stringifyException(ie2));          
+        }
       }
     }
     
@@ -995,7 +1004,8 @@
         }
 
         /**
-         * This task has run on too long, and should be killed.
+         * Something went wrong and the task must be killed.
+         * @param wasFailure was it a failure (versus a kill request)?
          */
         public synchronized void killAndCleanup(boolean wasFailure
                                                 ) throws IOException {
@@ -1005,6 +1015,13 @@
                   failures += 1;
                 }
                 runner.kill();
+            } else if (runstate == TaskStatus.State.UNASSIGNED) {
+              if (wasFailure) {
+                failures += 1;
+                runstate = TaskStatus.State.FAILED;
+              } else {
+                runstate = TaskStatus.State.KILLED;
+              }
             }
         }