Author: cutting Date: Mon Jul 18 13:57:34 2005 New Revision: 219566 URL: http://svn.apache.org/viewcvs?rev=219566&view=rev Log: Catch Throwable, not just Exception, and always log and report it to tracker.
Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskRunner.java lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskTracker.java Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskRunner.java URL: http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskRunner.java?rev=219566&r1=219565&r2=219566&view=diff ============================================================================== --- lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskRunner.java (original) +++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskRunner.java Mon Jul 18 13:57:34 2005 @@ -94,8 +94,15 @@ t.getTaskId() // pass task identifier }, null); - } catch (Exception e) { - LOG.log(Level.WARNING, "Child Error", e); + } catch (Throwable throwable) { + LOG.log(Level.WARNING, "Child Error", throwable); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + throwable.printStackTrace(new PrintStream(baos)); + try { + tracker.reportDiagnosticInfo(t.getTaskId(), baos.toString()); + } catch (IOException e) { + LOG.log(Level.WARNING, "Reporting Diagnostics", e); + } } finally { tracker.reportTaskFinished(t.getTaskId()); } Modified: lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskTracker.java URL: http://svn.apache.org/viewcvs/lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskTracker.java?rev=219566&r1=219565&r2=219566&view=diff ============================================================================== --- lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskTracker.java (original) +++ lucene/nutch/branches/mapred/src/java/org/apache/nutch/mapred/TaskTracker.java Mon Jul 18 13:57:34 2005 @@ -502,7 +502,7 @@ * The main() for child processes. */ public static class Child { - public static void main(String[] args) throws Exception { + public static void main(String[] args) throws Throwable { LogFormatter.showTime(false); LOG.info("Child starting"); @@ -516,12 +516,12 @@ JobConf job = new JobConf(task.getJobFile()); try { task.run(job, umbilical); // run the task - } catch (Exception ie) { + } catch (Throwable throwable) { + LOG.log(Level.WARNING, "Failed to spawn child", throwable); // Report back any failures, for diagnostic purposes ByteArrayOutputStream baos = new ByteArrayOutputStream(); - ie.printStackTrace(new PrintStream(baos)); + throwable.printStackTrace(new PrintStream(baos)); umbilical.reportDiagnosticInfo(taskid, baos.toString()); - throw ie; } umbilical.done(taskid); }