Repository: spark
Updated Branches:
  refs/heads/master bc36fe6e8 -> 73c20bf32


[SPARK-14391][LAUNCHER] Fix launcher communication test, take 2.

There's actually a race here: the state of the handler was changed before
the connection was set, so the test code could be notified of the state
change, wake up, and still see the connection as null, triggering the assert.

Author: Marcelo Vanzin <[email protected]>

Closes #12785 from vanzin/SPARK-14391.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/73c20bf3
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/73c20bf3
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/73c20bf3

Branch: refs/heads/master
Commit: 73c20bf32524c2232febc8c4b12d5fa228347163
Parents: bc36fe6
Author: Marcelo Vanzin <[email protected]>
Authored: Fri Apr 29 23:13:50 2016 -0700
Committer: Reynold Xin <[email protected]>
Committed: Fri Apr 29 23:13:50 2016 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/spark/launcher/LauncherServer.java   | 2 +-
 .../test/java/org/apache/spark/launcher/LauncherServerSuite.java  | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/73c20bf3/launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java
----------------------------------------------------------------------
diff --git 
a/launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java 
b/launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java
index 69fbf43..e3413fd 100644
--- a/launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java
+++ b/launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java
@@ -298,8 +298,8 @@ class LauncherServer implements Closeable {
           Hello hello = (Hello) msg;
           ChildProcAppHandle handle = pending.remove(hello.secret);
           if (handle != null) {
-            handle.setState(SparkAppHandle.State.CONNECTED);
             handle.setConnection(this);
+            handle.setState(SparkAppHandle.State.CONNECTED);
             this.handle = handle;
           } else {
             throw new IllegalArgumentException("Received Hello for unknown 
client.");

http://git-wip-us.apache.org/repos/asf/spark/blob/73c20bf3/launcher/src/test/java/org/apache/spark/launcher/LauncherServerSuite.java
----------------------------------------------------------------------
diff --git 
a/launcher/src/test/java/org/apache/spark/launcher/LauncherServerSuite.java 
b/launcher/src/test/java/org/apache/spark/launcher/LauncherServerSuite.java
index 22b834c..bfe1fcc 100644
--- a/launcher/src/test/java/org/apache/spark/launcher/LauncherServerSuite.java
+++ b/launcher/src/test/java/org/apache/spark/launcher/LauncherServerSuite.java
@@ -26,7 +26,6 @@ import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.Semaphore;
 import java.util.concurrent.TimeUnit;
 
-import org.junit.Ignore;
 import org.junit.Test;
 import static org.junit.Assert.*;
 
@@ -62,7 +61,7 @@ public class LauncherServerSuite extends BaseSuite {
     }
   }
 
-  @Ignore
+  @Test
   public void testCommunication() throws Exception {
     ChildProcAppHandle handle = LauncherServer.newAppHandle();
     TestClient client = null;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to