Skip to content

Commit 92fc0a8

Browse files
zsxwingsrowen
authored andcommitted
[SPARK-26069][TESTS][FOLLOWUP] Add another possible error message
## What changes were proposed in this pull request? `org.apache.spark.network.RpcIntegrationSuite.sendRpcWithStreamFailures` is still flaky and here is error message: ``` sbt.ForkMain$ForkError: java.lang.AssertionError: Got a non-empty set [Failed to send RPC RPC 8249697863992194475 to /172.17.0.2:41177: java.io.IOException: Broken pipe] at org.junit.Assert.fail(Assert.java:88) at org.junit.Assert.assertTrue(Assert.java:41) at org.apache.spark.network.RpcIntegrationSuite.assertErrorAndClosed(RpcIntegrationSuite.java:389) at org.apache.spark.network.RpcIntegrationSuite.sendRpcWithStreamFailures(RpcIntegrationSuite.java:347) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runners.Suite.runChild(Suite.java:128) at org.junit.runners.Suite.runChild(Suite.java:27) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.junit.runner.JUnitCore.run(JUnitCore.java:137) at org.junit.runner.JUnitCore.run(JUnitCore.java:115) at com.novocode.junit.JUnitRunner$1.execute(JUnitRunner.java:132) at sbt.ForkMain$Run$2.call(ForkMain.java:296) at sbt.ForkMain$Run$2.call(ForkMain.java:286) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748) ``` This happened when the second RPC message was being sent but the connection was closed at the same time. ## How was this patch tested? Jenkins Closes apache#23109 from zsxwing/SPARK-26069-2. Authored-by: Shixiong Zhu <[email protected]> Signed-off-by: Sean Owen <[email protected]>
1 parent 1d3dd58 commit 92fc0a8

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

common/network-common/src/test/java/org/apache/spark/network/RpcIntegrationSuite.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -371,26 +371,30 @@ private void assertErrorsContain(Set<String> errors, Set<String> contains) {
371371

372372
private void assertErrorAndClosed(RpcResult result, String expectedError) {
373373
assertTrue("unexpected success: " + result.successMessages, result.successMessages.isEmpty());
374-
// we expect 1 additional error, which should contain one of the follow messages:
375-
// - "closed"
376-
// - "Connection reset"
377-
// - "java.nio.channels.ClosedChannelException"
378374
Set<String> errors = result.errorMessages;
379375
assertEquals("Expected 2 errors, got " + errors.size() + "errors: " +
380376
errors, 2, errors.size());
381377

378+
// We expect 1 additional error due to closed connection and here are possible keywords in the
379+
// error message.
380+
Set<String> possibleClosedErrors = Sets.newHashSet(
381+
"closed",
382+
"Connection reset",
383+
"java.nio.channels.ClosedChannelException",
384+
"java.io.IOException: Broken pipe"
385+
);
382386
Set<String> containsAndClosed = Sets.newHashSet(expectedError);
383-
containsAndClosed.add("closed");
384-
containsAndClosed.add("Connection reset");
385-
containsAndClosed.add("java.nio.channels.ClosedChannelException");
387+
containsAndClosed.addAll(possibleClosedErrors);
386388

387389
Pair<Set<String>, Set<String>> r = checkErrorsContain(errors, containsAndClosed);
388390

389391
assertTrue("Got a non-empty set " + r.getLeft(), r.getLeft().isEmpty());
390392

391393
Set<String> errorsNotFound = r.getRight();
392394
assertEquals(
393-
"The size of " + errorsNotFound.toString() + " was not 2", 2, errorsNotFound.size());
395+
"The size of " + errorsNotFound + " was not " + (possibleClosedErrors.size() - 1),
396+
possibleClosedErrors.size() - 1,
397+
errorsNotFound.size());
394398
for (String err: errorsNotFound) {
395399
assertTrue("Found a wrong error " + err, containsAndClosed.contains(err));
396400
}

0 commit comments

Comments
 (0)