Repository: hbase Updated Branches: refs/heads/branch-1 a75e5a543 -> 8574934f5
HBASE-17381 ReplicationSourceWorkerThread can die due to unhandled exceptions (huzheng) Signed-off-by: Gary Helmling <ga...@apache.org> Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/8574934f Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/8574934f Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/8574934f Branch: refs/heads/branch-1 Commit: 8574934f5912b09b785444036bfee9740c966bbb Parents: a75e5a5 Author: huzheng <open...@gmail.com> Authored: Mon Feb 6 11:20:11 2017 +0800 Committer: Gary Helmling <ga...@apache.org> Committed: Tue Feb 7 17:33:42 2017 -0800 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/regionserver/RSRpcServices.java | 6 +++++- .../hbase/replication/regionserver/ReplicationSource.java | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/8574934f/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java index c1b277a..09649c5 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/RSRpcServices.java @@ -1228,6 +1228,10 @@ public class RSRpcServices implements HBaseRPCErrorHandler, */ @Override public boolean checkOOME(final Throwable e) { + return exitIfOOME(e); + } + + public static boolean exitIfOOME(final Throwable e ){ boolean stop = false; try { if (e instanceof OutOfMemoryError @@ -1235,7 +1239,7 @@ public class RSRpcServices implements HBaseRPCErrorHandler, || (e.getMessage() != null && e.getMessage().contains( "java.lang.OutOfMemoryError"))) { stop = true; - LOG.fatal("Run out of memory; " + getClass().getSimpleName() + LOG.fatal("Run out of memory; " + RSRpcServices.class.getSimpleName() + " will abort itself immediately", e); } } finally { http://git-wip-us.apache.org/repos/asf/hbase/blob/8574934f/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java index 3f25fe5..2b13b56 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java @@ -58,6 +58,7 @@ import org.apache.hadoop.hbase.classification.InterfaceAudience; import org.apache.hadoop.hbase.protobuf.generated.WALProtos; import org.apache.hadoop.hbase.protobuf.generated.WALProtos.BulkLoadDescriptor; import org.apache.hadoop.hbase.protobuf.generated.WALProtos.StoreDescriptor; +import org.apache.hadoop.hbase.regionserver.RSRpcServices; import org.apache.hadoop.hbase.regionserver.wal.WALEdit; import org.apache.hadoop.hbase.replication.ChainWALEntryFilter; import org.apache.hadoop.hbase.replication.ReplicationEndpoint; @@ -1289,8 +1290,10 @@ public class ReplicationSource extends Thread Thread.UncaughtExceptionHandler handler = new Thread.UncaughtExceptionHandler() { @Override public void uncaughtException(final Thread t, final Throwable e) { + RSRpcServices.exitIfOOME(e); LOG.error("Unexpected exception in ReplicationSourceWorkerThread," + " currentPath=" + getCurrentPath(), e); + stopper.stop("Unexpected exception in ReplicationSourceWorkerThread"); } }; Threads.setDaemonThreadRunning(this, n + ".replicationSource." + walGroupId + ","