From 5f5f4e82b126b27f833f643abeded67dae3af05d Mon Sep 17 00:00:00 2001 From: Allan Yang Date: Wed, 24 Oct 2018 11:10:20 +0800 Subject: [PATCH] HBASE-21357 RS should abort if OOM in Reader thread --- .../java/org/apache/hadoop/hbase/ipc/RpcServer.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java index 3f11233e55f..a32040c2959 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java @@ -732,6 +732,17 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver { LOG.error(getName() + ": CancelledKeyException in Reader", e); } catch (IOException ex) { LOG.info(getName() + ": IOException in Reader", ex); + } catch (OutOfMemoryError e) { + if (getErrorHandler() != null) { + if (getErrorHandler().checkOOME(e)) { + RpcServer.LOG.info(Thread.currentThread().getName() + + ": exiting on OutOfMemoryError"); + return; + } + } else { + // rethrow if no handler + throw e; + } } } }