hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acmur...@apache.org
Subject svn commit: r1378791 - in /hadoop/common/branches/branch-1-win: CHANGES.branch-1-win.txt src/test/org/apache/hadoop/mapred/TestKillSubProcesses.java
Date Thu, 30 Aug 2012 02:25:30 GMT
Author: acmurthy
Date: Thu Aug 30 02:25:29 2012
New Revision: 1378791

URL: http://svn.apache.org/viewvc?rev=1378791&view=rev
Log:
MAPREDUCE-4597. Fix intermittent failures in TestKillSubProcesses. Contributed by Bikas Saha.

Modified:
    hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt
    hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestKillSubProcesses.java

Modified: hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt?rev=1378791&r1=1378790&r2=1378791&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt (original)
+++ hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt Thu Aug 30 02:25:29 2012
@@ -81,3 +81,6 @@ BUG FIXES
     HADOOP-8657. Fix TestCLI to not hardcode file length since it's
     encoding/platform dependent. (Bikas Saha via acmurthy) 
 
+    MAPREDUCE-4597. Fix intermittent failures in TestKillSubProcesses. (Bikas
+    Saha via acmurthy)
+

Modified: hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestKillSubProcesses.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestKillSubProcesses.java?rev=1378791&r1=1378790&r2=1378791&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestKillSubProcesses.java
(original)
+++ hadoop/common/branches/branch-1-win/src/test/org/apache/hadoop/mapred/TestKillSubProcesses.java
Thu Aug 30 02:25:29 2012
@@ -203,15 +203,23 @@ public class TestKillSubProcesses extend
     if(ProcessTree.isSetsidAvailable) {
       if(Shell.WINDOWS) {
         try {
-          Thread.sleep(1000);
-          String result = Shell.execCommand("cmd", "/c", Shell.WINUTILS
-              + " task isAlive " + pid);
-          assertTrue("Map process tree not alive", result.contains("IsAlive"));
-          String[] parts = result.split("[,\r\n]");
-          assertTrue(parts.length >= 2);
-          // > numLevelsOfSubProcesses because of winutils etc are also part of 
-          // the task job object along with the spawned scripts
-          assertTrue(Integer.parseInt(parts[1]) > numLevelsOfSubProcesses);
+          int sleepCount = 5;
+          int numChildren = 0;
+          while(sleepCount-- > 0) {
+            Thread.sleep(1000);
+            String result = Shell.execCommand("cmd", "/c", Shell.WINUTILS
+                + " task isAlive " + pid);
+            assertTrue("Map process tree not alive", result.contains("IsAlive"));
+            String[] parts = result.split("[,\r\n]");
+            assertTrue(parts.length >= 2);
+            // > numLevelsOfSubProcesses because of winutils etc are also part of 
+            // the task job object along with the spawned scripts
+            numChildren = Integer.parseInt(parts[1]);
+            if(numChildren > numLevelsOfSubProcesses){
+              break;
+            }
+          }
+          assertTrue(numChildren > numLevelsOfSubProcesses);
         } catch (InterruptedException ie) {
           // ignore
         }



Mime
View raw message