From d71938ae361c7bf4d960e84630ba3fa7e5aff4cd Mon Sep 17 00:00:00 2001 From: tom lee Date: Wed, 15 Sep 2021 19:44:23 +0800 Subject: [PATCH 1/4] HADOOP-17914. Print RPC response length in the exception message --- .../src/main/java/org/apache/hadoop/ipc/Client.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java index 712db04d0ee01..89967744d7709 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/ipc/Client.java @@ -1907,10 +1907,12 @@ public ByteBuffer readResponse() throws IOException { } } if (length <= 0) { - throw new RpcException("RPC response has invalid length"); + throw new RpcException(String.format("RPC response has " + + "invalid length of %d", length)); } if (maxResponseLength > 0 && length > maxResponseLength) { - throw new RpcException("RPC response exceeds maximum data length"); + throw new RpcException(String.format("RPC response has a " + + "length of %d exceeds maximum data length", length)); } ByteBuffer bb = ByteBuffer.allocate(length); in.readFully(bb.array()); From 707879d05f72c43a4238715c5112db11d9ed3623 Mon Sep 17 00:00:00 2001 From: tom lee Date: Thu, 16 Sep 2021 08:30:55 +0800 Subject: [PATCH 2/4] fix unit test --- .../src/test/java/org/apache/hadoop/ipc/TestIPC.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java index 99047ffd0e03c..577193602d376 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java @@ -1638,8 +1638,7 @@ public void testRpcResponseLimit() throws Throwable { } catch (IOException ioe) { Assert.assertNotNull(ioe); Assert.assertEquals(RpcException.class, ioe.getClass()); - Assert.assertEquals("RPC response exceeds maximum data length", - ioe.getMessage()); + Assert.assertTrue(ioe.getMessage().contains("exceeds maximum data length")); return; } Assert.fail("didn't get limit exceeded"); From 4687694b792d2ecbb09317c56296103c1edfce0f Mon Sep 17 00:00:00 2001 From: tom lee Date: Thu, 16 Sep 2021 10:11:42 +0800 Subject: [PATCH 3/4] fix unit test --- .../src/test/java/org/apache/hadoop/ipc/TestIPC.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java index 577193602d376..95ff302103d89 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java @@ -1638,7 +1638,8 @@ public void testRpcResponseLimit() throws Throwable { } catch (IOException ioe) { Assert.assertNotNull(ioe); Assert.assertEquals(RpcException.class, ioe.getClass()); - Assert.assertTrue(ioe.getMessage().contains("exceeds maximum data length")); + Assert.assertTrue(ioe.getMessage().contains( + "exceeds maximum data length")); return; } Assert.fail("didn't get limit exceeded"); From 08125eae237b106e0ff159abf5e9030b7a6d6b52 Mon Sep 17 00:00:00 2001 From: tom lee Date: Fri, 17 Sep 2021 09:35:43 +0800 Subject: [PATCH 4/4] empty commit