Skip to content

Commit b133501

Browse files
author
Marcelo Vanzin
committed
[SPARK-21522][CORE] Fix flakiness in LauncherServerSuite.
Handle the case where the server closes the socket before the full message has been written by the client. Author: Marcelo Vanzin <[email protected]> Closes #18727 from vanzin/SPARK-21522.
1 parent 97ccc63 commit b133501

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import java.io.ObjectInputStream;
2323
import java.net.InetAddress;
2424
import java.net.Socket;
25+
import java.net.SocketException;
2526
import java.util.Arrays;
2627
import java.util.List;
2728
import java.util.concurrent.BlockingQueue;
@@ -171,7 +172,15 @@ public void testStreamFiltering() throws Exception {
171172
LauncherServer.getServerInstance().getPort());
172173

173174
client = new TestClient(s);
174-
client.send(new EvilPayload());
175+
176+
try {
177+
client.send(new EvilPayload());
178+
} catch (SocketException se) {
179+
// SPARK-21522: this can happen if the server closes the socket before the full message has
180+
// been written, so it's expected. It may cause false positives though (socket errors
181+
// happening for other reasons).
182+
}
183+
175184
waitForError(client, handle.getSecret());
176185
assertEquals(0, EvilPayload.EVIL_BIT);
177186
} finally {

0 commit comments

Comments
 (0)