From 0f7285a81a75b14be937e411f949081d465d1b92 Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Thu, 8 Mar 2012 05:00:01 +0000 Subject: [PATCH] HBASE-4890 fix possible NPE in HConnectionManager git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1298272 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/hadoop/hbase/ipc/HBaseClient.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java b/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java index fd99eece816..2602461c58e 100644 --- a/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java +++ b/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java @@ -676,7 +676,17 @@ public class HBaseClient { Call c = itor.next().getValue(); long waitTime = System.currentTimeMillis() - c.getStartTime(); if (waitTime >= rpcTimeout) { - c.setException(closeException); // local exception + if (this.closeException == null) { + // There may be no exception in the case that there are many calls + // being multiplexed over this connection and these are succeeding + // fine while this Call object is taking a long time to finish + // over on the server; e.g. I just asked the regionserver to bulk + // open 3k regions or its a big fat multiput into a heavily-loaded + // server (Perhaps this only happens at the extremes?) + this.closeException = new CallTimeoutException("Call id=" + c.id + + ", waitTime=" + waitTime + ", rpcTimetout=" + rpcTimeout); + } + c.setException(this.closeException); synchronized (c) { c.notifyAll(); } @@ -705,6 +715,15 @@ public class HBaseClient { } } + /** + * Client-side call timeout + */ + public static class CallTimeoutException extends IOException { + public CallTimeoutException(final String msg) { + super(msg); + } + } + /** Call implementation used for parallel calls. */ protected class ParallelCall extends Call { private final ParallelResults results;