incubator-hama-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edwardy...@apache.org
Subject svn commit: r1240683 - in /incubator/hama: branches/0.4/ branches/0.4/core/src/main/java/org/apache/hama/bsp/ branches/0.4/src/site/xdoc/ trunk/ trunk/core/src/main/java/org/apache/hama/bsp/ trunk/src/site/xdoc/
Date Sun, 05 Feb 2012 08:47:25 GMT
Author: edwardyoon
Date: Sun Feb  5 08:47:24 2012
New Revision: 1240683

URL: http://svn.apache.org/viewvc?rev=1240683&view=rev
Log:
Fix error reading child output

Modified:
    incubator/hama/branches/0.4/CHANGES.txt
    incubator/hama/branches/0.4/core/src/main/java/org/apache/hama/bsp/TaskRunner.java
    incubator/hama/branches/0.4/src/site/xdoc/index.xml
    incubator/hama/trunk/CHANGES.txt
    incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/TaskRunner.java
    incubator/hama/trunk/src/site/xdoc/index.xml

Modified: incubator/hama/branches/0.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hama/branches/0.4/CHANGES.txt?rev=1240683&r1=1240682&r2=1240683&view=diff
==============================================================================
--- incubator/hama/branches/0.4/CHANGES.txt (original)
+++ incubator/hama/branches/0.4/CHANGES.txt Sun Feb  5 08:47:24 2012
@@ -1,6 +1,6 @@
 Hama Change Log
 
-Release 0.4 - Unreleased
+Release 0.4 - February 5, 2012
 
   NEW FEATURES
 
@@ -19,6 +19,7 @@ Release 0.4 - Unreleased
 
   BUG FIXES
 
+    HAMA-506: Error reading child output (edwardyoon)
     HAMA-488: PageRank refactor and fix bugs (tjungblut via edwardyoon)
     HAMA-489: Check port availability before forking child process (edwardyoon)
     HAMA-474: ClusterStatus.getTasks() always returns 0 (edwardyoon)

Modified: incubator/hama/branches/0.4/core/src/main/java/org/apache/hama/bsp/TaskRunner.java
URL: http://svn.apache.org/viewvc/incubator/hama/branches/0.4/core/src/main/java/org/apache/hama/bsp/TaskRunner.java?rev=1240683&r1=1240682&r2=1240683&view=diff
==============================================================================
--- incubator/hama/branches/0.4/core/src/main/java/org/apache/hama/bsp/TaskRunner.java (original)
+++ incubator/hama/branches/0.4/core/src/main/java/org/apache/hama/bsp/TaskRunner.java Sun
Feb  5 08:47:24 2012
@@ -55,6 +55,8 @@ public class TaskRunner extends Thread {
 
   boolean bspKilled = false;
   private Process bspProcess;
+  private Thread errorLog;
+  private Thread infoLog;
 
   private final Task task;
   private final BSPJob conf;
@@ -95,17 +97,20 @@ public class TaskRunner extends Thread {
       builder.directory(workDir);
       try {
         bspProcess = builder.start();
-        new Thread() {
+
+        errorLog = new Thread() {
           public void run() {
             logStream(bspProcess.getErrorStream(), LogType.ERROR);
           }
-        }.start();
+        };
+        errorLog.start();
 
-        new Thread() {
+        infoLog = new Thread() {
           public void run() {
             logStream(bspProcess.getInputStream(), LogType.STDOUT);
           }
-        }.start();
+        };
+        infoLog.start();
 
         int exit_code = bspProcess.waitFor();
         if (!bspKilled && exit_code != 0) {
@@ -113,8 +118,7 @@ public class TaskRunner extends Thread {
               + exit_code + ".");
         }
       } catch (InterruptedException e) {
-        LOG.warn("Thread is interrupted when execeuting BSP process.",
-            e);
+        LOG.warn("Thread is interrupted when execeuting BSP process.", e);
       } catch (IOException ioe) {
         LOG.error("Error when executing BSPPeer process.", ioe);
       } finally {
@@ -203,7 +207,7 @@ public class TaskRunner extends Thread {
     vargs.add(classPath.toString());
     // Add main class and its arguments
     LOG.debug("Executing child Process " + child.getName());
-    vargs.add(child.getName()); // bsp class name 
+    vargs.add(child.getName()); // bsp class name
 
     if (GroomServer.BSPPeerChild.class.equals(child)) {
       InetSocketAddress addr = groomServer.getTaskTrackerReportAddress();
@@ -234,6 +238,8 @@ public class TaskRunner extends Thread {
       LOG.error("BSPPeer child process is interrupted.", ie);
     } catch (ExecutionException ee) {
       LOG.error("Failure occurs when retrieving tasks result.", ee);
+    } finally {
+      killBsp();
     }
     LOG.debug("Finishes executing BSPPeer child process.");
   }
@@ -257,13 +263,19 @@ public class TaskRunner extends Thread {
   }
 
   /**
-   * Kill bsppeer child process.
+   * Kill bspPeer child process.
    */
   public void killBsp() {
+    bspKilled = true;
+
+    if (errorLog != null || infoLog != null) {
+      errorLog = null;
+      infoLog = null;
+    }
+
     if (bspProcess != null) {
       bspProcess.destroy();
     }
-    bspKilled = true;
   }
 
   /**
@@ -287,7 +299,9 @@ public class TaskRunner extends Thread {
         writer.newLine();
       }
     } catch (IOException e) {
-      LOG.warn(task.getTaskID() + " Error reading child output", e);
+      if (!bspKilled) {
+        LOG.warn(task.getTaskID() + " Error reading child output", e);
+      }
     } finally {
       try {
         input.close();

Modified: incubator/hama/branches/0.4/src/site/xdoc/index.xml
URL: http://svn.apache.org/viewvc/incubator/hama/branches/0.4/src/site/xdoc/index.xml?rev=1240683&r1=1240682&r2=1240683&view=diff
==============================================================================
--- incubator/hama/branches/0.4/src/site/xdoc/index.xml (original)
+++ incubator/hama/branches/0.4/src/site/xdoc/index.xml Sun Feb  5 08:47:24 2012
@@ -41,7 +41,7 @@ xsi:schemaLocation="http://maven.apache.
       <tr><td> 
           <h3 align="center">Recent News</h3>
           <ul>
-            <li>Jan 30, 2012: release 0.4.0 available</li>
+            <li>Feb 5, 2012: release 0.4.0 available</li>
             <li>July 28, 2011: release 0.3.0 available</li>
             <li>June 2, 2011: release 0.2.0 available</li>
             <li>Apr 30, 2010: Introduced in the <a href="http://www.bsp-worldwide.org/bspww3000.html">BSP
Worldwide</a></li>

Modified: incubator/hama/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/CHANGES.txt?rev=1240683&r1=1240682&r2=1240683&view=diff
==============================================================================
--- incubator/hama/trunk/CHANGES.txt (original)
+++ incubator/hama/trunk/CHANGES.txt Sun Feb  5 08:47:24 2012
@@ -1,6 +1,6 @@
 Hama Change Log
 
-Release 0.4 - Unreleased
+Release 0.4 - February 5, 2012
 
   NEW FEATURES
 
@@ -19,6 +19,7 @@ Release 0.4 - Unreleased
 
   BUG FIXES
 
+    HAMA-506: Error reading child output (edwardyoon)
     HAMA-488: PageRank refactor and fix bugs (tjungblut via edwardyoon)
     HAMA-489: Check port availability before forking child process (edwardyoon)
     HAMA-474: ClusterStatus.getTasks() always returns 0 (edwardyoon)

Modified: incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/TaskRunner.java
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/TaskRunner.java?rev=1240683&r1=1240682&r2=1240683&view=diff
==============================================================================
--- incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/TaskRunner.java (original)
+++ incubator/hama/trunk/core/src/main/java/org/apache/hama/bsp/TaskRunner.java Sun Feb  5
08:47:24 2012
@@ -55,6 +55,8 @@ public class TaskRunner extends Thread {
 
   boolean bspKilled = false;
   private Process bspProcess;
+  private Thread errorLog;
+  private Thread infoLog;
 
   private final Task task;
   private final BSPJob conf;
@@ -95,17 +97,20 @@ public class TaskRunner extends Thread {
       builder.directory(workDir);
       try {
         bspProcess = builder.start();
-        new Thread() {
+
+        errorLog = new Thread() {
           public void run() {
             logStream(bspProcess.getErrorStream(), LogType.ERROR);
           }
-        }.start();
+        };
+        errorLog.start();
 
-        new Thread() {
+        infoLog = new Thread() {
           public void run() {
             logStream(bspProcess.getInputStream(), LogType.STDOUT);
           }
-        }.start();
+        };
+        infoLog.start();
 
         int exit_code = bspProcess.waitFor();
         if (!bspKilled && exit_code != 0) {
@@ -113,8 +118,7 @@ public class TaskRunner extends Thread {
               + exit_code + ".");
         }
       } catch (InterruptedException e) {
-        LOG.warn("Thread is interrupted when execeuting BSP process.",
-            e);
+        LOG.warn("Thread is interrupted when execeuting BSP process.", e);
       } catch (IOException ioe) {
         LOG.error("Error when executing BSPPeer process.", ioe);
       } finally {
@@ -203,7 +207,7 @@ public class TaskRunner extends Thread {
     vargs.add(classPath.toString());
     // Add main class and its arguments
     LOG.debug("Executing child Process " + child.getName());
-    vargs.add(child.getName()); // bsp class name 
+    vargs.add(child.getName()); // bsp class name
 
     if (GroomServer.BSPPeerChild.class.equals(child)) {
       InetSocketAddress addr = groomServer.getTaskTrackerReportAddress();
@@ -234,6 +238,8 @@ public class TaskRunner extends Thread {
       LOG.error("BSPPeer child process is interrupted.", ie);
     } catch (ExecutionException ee) {
       LOG.error("Failure occurs when retrieving tasks result.", ee);
+    } finally {
+      killBsp();
     }
     LOG.debug("Finishes executing BSPPeer child process.");
   }
@@ -257,13 +263,19 @@ public class TaskRunner extends Thread {
   }
 
   /**
-   * Kill bsppeer child process.
+   * Kill bspPeer child process.
    */
   public void killBsp() {
+    bspKilled = true;
+
+    if (errorLog != null || infoLog != null) {
+      errorLog = null;
+      infoLog = null;
+    }
+
     if (bspProcess != null) {
       bspProcess.destroy();
     }
-    bspKilled = true;
   }
 
   /**
@@ -287,7 +299,9 @@ public class TaskRunner extends Thread {
         writer.newLine();
       }
     } catch (IOException e) {
-      LOG.warn(task.getTaskID() + " Error reading child output", e);
+      if (!bspKilled) {
+        LOG.warn(task.getTaskID() + " Error reading child output", e);
+      }
     } finally {
       try {
         input.close();

Modified: incubator/hama/trunk/src/site/xdoc/index.xml
URL: http://svn.apache.org/viewvc/incubator/hama/trunk/src/site/xdoc/index.xml?rev=1240683&r1=1240682&r2=1240683&view=diff
==============================================================================
--- incubator/hama/trunk/src/site/xdoc/index.xml (original)
+++ incubator/hama/trunk/src/site/xdoc/index.xml Sun Feb  5 08:47:24 2012
@@ -41,7 +41,7 @@ xsi:schemaLocation="http://maven.apache.
       <tr><td> 
           <h3 align="center">Recent News</h3>
           <ul>
-            <li>Jan 30, 2012: release 0.4.0 available</li>
+            <li>Feb 5, 2012: release 0.4.0 available</li>
             <li>July 28, 2011: release 0.3.0 available</li>
             <li>June 2, 2011: release 0.2.0 available</li>
             <li>Apr 30, 2010: Introduced in the <a href="http://www.bsp-worldwide.org/bspww3000.html">BSP
Worldwide</a></li>



Mime
View raw message