From e327233e80099783c655876899f952c1377db13c Mon Sep 17 00:00:00 2001 From: Kihwal Lee Date: Tue, 20 Oct 2015 15:19:01 -0500 Subject: [PATCH] HADOOP-12418. TestRPC.testRPCInterruptedSimple fails intermittently. Contributed Kihwal Lee. (cherry picked from commit 01b103f4ff2e8ee7e71d082885436c5cb7c6be0b) Conflicts: hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestRPC.java --- hadoop-common-project/hadoop-common/CHANGES.txt | 3 +++ .../src/test/java/org/apache/hadoop/ipc/TestRPC.java | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt index d5c2a5e6e0c..3d2e840031a 100644 --- a/hadoop-common-project/hadoop-common/CHANGES.txt +++ b/hadoop-common-project/hadoop-common/CHANGES.txt @@ -739,6 +739,9 @@ Release 2.8.0 - UNRELEASED HADOOP-12474. MiniKMS should use random ports for Jetty server by default. (Mingliang Liu via wheat9) + HADOOP-12418. TestRPC.testRPCInterruptedSimple fails intermittently. + (kihwal) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestRPC.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestRPC.java index 75f46959329..43b2aa32dae 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestRPC.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestRPC.java @@ -28,6 +28,7 @@ import static org.junit.Assert.assertTrue; import static org.junit.Assert.fail; import java.io.Closeable; +import java.io.InterruptedIOException; import java.io.IOException; import java.lang.management.ManagementFactory; import java.lang.management.ThreadInfo; @@ -884,11 +885,13 @@ public class TestRPC { proxy.ping(); fail("Interruption did not cause IPC to fail"); } catch (IOException ioe) { - if (!ioe.toString().contains("InterruptedException")) { - throw ioe; + if (ioe.toString().contains("InterruptedException") || + ioe instanceof InterruptedIOException) { + // clear interrupt status for future tests + Thread.interrupted(); + return; } - // clear interrupt status for future tests - Thread.interrupted(); + throw ioe; } finally { server.stop(); }