Skip to content

Commit

Permalink
[SPARK-21522][CORE] Fix flakiness in LauncherServerSuite.
Browse files Browse the repository at this point in the history
Handle the case where the server closes the socket before the full message
has been written by the client.

Author: Marcelo Vanzin <vanzin@cloudera.com>

Closes #18727 from vanzin/SPARK-21522.

(cherry picked from commit b133501)
Signed-off-by: Marcelo Vanzin <vanzin@cloudera.com>
  • Loading branch information
Marcelo Vanzin committed Aug 1, 2017
1 parent e2062b9 commit 1745434
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.io.ObjectInputStream;
import java.net.InetAddress;
import java.net.Socket;
import java.net.SocketException;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.BlockingQueue;
Expand Down Expand Up @@ -171,7 +172,15 @@ public void testStreamFiltering() throws Exception {
LauncherServer.getServerInstance().getPort());

client = new TestClient(s);
client.send(new EvilPayload());

try {
client.send(new EvilPayload());
} catch (SocketException se) {
// SPARK-21522: this can happen if the server closes the socket before the full message has
// been written, so it's expected. It may cause false positives though (socket errors
// happening for other reasons).
}

waitForError(client, handle.getSecret());
assertEquals(0, EvilPayload.EVIL_BIT);
} finally {
Expand Down

0 comments on commit 1745434

Please sign in to comment.