Skip to content

Commit 73c20bf

Browse files
Marcelo Vanzinrxin
authored andcommitted
[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.
1 parent bc36fe6 commit 73c20bf

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

launcher/src/main/java/org/apache/spark/launcher/LauncherServer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,8 +298,8 @@ protected void handle(Message msg) throws IOException {
298298
Hello hello = (Hello) msg;
299299
ChildProcAppHandle handle = pending.remove(hello.secret);
300300
if (handle != null) {
301-
handle.setState(SparkAppHandle.State.CONNECTED);
302301
handle.setConnection(this);
302+
handle.setState(SparkAppHandle.State.CONNECTED);
303303
this.handle = handle;
304304
} else {
305305
throw new IllegalArgumentException("Received Hello for unknown client.");

launcher/src/test/java/org/apache/spark/launcher/LauncherServerSuite.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import java.util.concurrent.Semaphore;
2727
import java.util.concurrent.TimeUnit;
2828

29-
import org.junit.Ignore;
3029
import org.junit.Test;
3130
import static org.junit.Assert.*;
3231

@@ -62,7 +61,7 @@ public void testLauncherServerReuse() throws Exception {
6261
}
6362
}
6463

65-
@Ignore
64+
@Test
6665
public void testCommunication() throws Exception {
6766
ChildProcAppHandle handle = LauncherServer.newAppHandle();
6867
TestClient client = null;

0 commit comments

Comments
 (0)