hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acmur...@apache.org
Subject svn commit: r1378793 - in /hadoop/common/branches/branch-1-win: CHANGES.branch-1-win.txt src/core/org/apache/hadoop/util/Shell.java
Date Thu, 30 Aug 2012 02:31:44 GMT
Author: acmurthy
Date: Thu Aug 30 02:31:44 2012
New Revision: 1378793

URL: http://svn.apache.org/viewvc?rev=1378793&view=rev
Log:
HADOOP-8732. Fix intermittent failures in tests by serializing process creation to get around
a bug in MS Windows. Contributed by Ivan Mitic. 

Modified:
    hadoop/common/branches/branch-1-win/CHANGES.branch-1-win.txt
    hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/util/Shell.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=1378793&r1=1378792&r2=1378793&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:31:44 2012
@@ -87,3 +87,5 @@ BUG FIXES
     MAPREDUCE-4597. Fix intermittent failures in TestKillSubProcesses. (Bikas
     Saha via acmurthy)
 
+    HADOOP-8732. Fix intermittent failures in tests by serializing process
+    creation to get around a bug in MS Windows. (Ivan Mitic via acmurthy)

Modified: hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/util/Shell.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/util/Shell.java?rev=1378793&r1=1378792&r2=1378793&view=diff
==============================================================================
--- hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/util/Shell.java (original)
+++ hadoop/common/branches/branch-1-win/src/core/org/apache/hadoop/util/Shell.java Thu Aug
30 02:31:44 2012
@@ -48,6 +48,9 @@ abstract public class Shell {
   /** a Unix command to get the current user's name */
   public final static String USER_NAME_COMMAND = "whoami";
 
+  /** Windows CreateProcess synchronization object */
+  public static final Object WindowsProcessLaunchLock = new Object();
+
   /** a Unix command to set the change user's groups list */
   public static final String SET_GROUP_COMMAND = "chgrp";
 
@@ -253,7 +256,19 @@ abstract public class Shell {
       builder.directory(this.dir);
     }
     
-    process = builder.start();
+    if (Shell.WINDOWS) {
+      synchronized (WindowsProcessLaunchLock) {
+        // To workaround the race condition issue with child processes
+        // inheriting unintended handles during process launch that can
+        // lead to hangs on reading output and error streams, we
+        // serialize process creation. More info available at:
+        // http://support.microsoft.com/kb/315939
+        process = builder.start();
+      }
+    } else {
+      process = builder.start();
+    }
+
     if (timeOutInterval > 0) {
       timeOutTimer = new Timer();
       timeoutTimerTask = new ShellTimeoutTimerTask(



Mime
View raw message