From 26ff42091cc5f00df7e66db1e41b05868d551c59 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Chouhan Date: Mon, 13 Nov 2017 17:16:31 +0530 Subject: [PATCH] HBASE-19215 Incorrect exception handling on the client causes incorrect call timeouts and byte buffer allocations on the server Signed-off-by: Andrew Purtell Amending-Author: Andrew Purtell Conflicts: hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/BlockingRpcConnection.java --- .../src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java | 8 ++++++++ .../src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java | 7 +++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java index c238adbd56..9b2d717469 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/IPCUtil.java @@ -313,4 +313,12 @@ public class IPCUtil { Preconditions.checkArgument(totalSize < Integer.MAX_VALUE); return totalSize; } + + static IOException toIOE(Throwable t) { + if (t instanceof IOException) { + return (IOException) t; + } else { + return new IOException(t); + } + } } diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java index bc92c654cd..3052ab940a 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/RpcClientImpl.java @@ -924,11 +924,14 @@ public class RpcClientImpl extends AbstractRpcClient { try { call.callStats.setRequestSizeBytes(IPCUtil.write(this.out, header, call.param, cellBlock)); - } catch (IOException e) { + } catch (Throwable t) { + if (LOG.isTraceEnabled()) { + LOG.trace("Error while writing call, call_id:" + call.id, t); + } // We set the value inside the synchronized block, this way the next in line // won't even try to write. Otherwise we might miss a call in the calls map? shouldCloseConnection.set(true); - writeException = e; + writeException = IPCUtil.toIOE(t); interrupt(); } } -- 2.13.4