You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by mb...@apache.org on 2012/10/05 00:43:47 UTC

svn commit: r1394307 - in /hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase: client/HConnectionManager.java ipc/HBaseClient.java

Author: mbautin
Date: Thu Oct  4 22:43:47 2012
New Revision: 1394307

URL: http://svn.apache.org/viewvc?rev=1394307&view=rev
Log:
[jira] [HBASE-6943] [89-fb] Do not catch certain exceptions trying to get an RS connection

Author: mbautin

Summary: When getting a regionserver connection in 0.89-fb in HBaseClient, we catch all types of Throwable. I have observed a real case when the client looked stuck. On debugging it turned out that a NoSuchMethodError was thrown and caught, leaving the connection in an inconsistent state (initialized socket but null streams). All following attempts resulted in NPEs that were also caught, and no errors were logged. From the user's perspective the client was just stuck. The root cause was the absence of a required jar (hence the NoSuchMethodError) but it was not reported properly.

Test Plan: Run a client with the same configuration as before and verify it does not get stuck.

Reviewers: kannan, liyintang, kranganathan

Reviewed By: kannan

CC: avf, adela, pritamdamania, aaiyer, nspiegelberg, amirshim, mycnyc

Differential Revision: https://reviews.facebook.net/D5877

Modified:
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
    hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java?rev=1394307&r1=1394306&r2=1394307&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/client/HConnectionManager.java Thu Oct  4 22:43:47 2012
@@ -2655,6 +2655,18 @@ public class HConnectionManager {
     }
 
     private Throwable translateException(Throwable t) throws IOException {
+      if (t instanceof NoSuchMethodError) {
+        // We probably can't recover from this exception by retrying.
+        LOG.error(t);
+        throw (NoSuchMethodError) t;
+      }
+
+      if (t instanceof NullPointerException) {
+        // The same here. This is probably a bug.
+        LOG.error(t);
+        throw (NullPointerException) t;
+      }
+
       if (t instanceof UndeclaredThrowableException) {
         t = t.getCause();
       }

Modified: hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java?rev=1394307&r1=1394306&r2=1394307&view=diff
==============================================================================
--- hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java (original)
+++ hbase/branches/0.89-fb/src/main/java/org/apache/hadoop/hbase/ipc/HBaseClient.java Thu Oct  4 22:43:47 2012
@@ -353,6 +353,12 @@ public class HBaseClient {
         close();
 
         throw e;
+      } catch (Throwable e) {
+        IOException ioe = new IOException("Unexpected connection error", e);
+        markClosed(ioe);
+        close();
+
+        throw ioe;
       }
     }