From commits-return-89052-archive-asf-public=cust-asf.ponee.io@hbase.apache.org Thu Sep 5 22:53:04 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id 4A5D9180656 for ; Fri, 6 Sep 2019 00:53:04 +0200 (CEST) Received: (qmail 52453 invoked by uid 500); 6 Sep 2019 08:19:13 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 52444 invoked by uid 99); 6 Sep 2019 08:19:13 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 06 Sep 2019 08:19:13 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id 048BF807F5; Thu, 5 Sep 2019 22:53:02 +0000 (UTC) Date: Thu, 05 Sep 2019 22:53:02 +0000 To: "commits@hbase.apache.org" Subject: [hbase] branch branch-2 updated: HBASE-22701 Disable the DynamicClassLoader when it fails to initialize MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <156772398262.28764.16000376049644886865@gitbox.apache.org> From: elserj@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: hbase X-Git-Refname: refs/heads/branch-2 X-Git-Reftype: branch X-Git-Oldrev: aeacfd3d59e75efbad2387481ad0f9ab2e8c51fa X-Git-Newrev: 2feca0abded953add6c807c9f8c483a719fedcd7 X-Git-Rev: 2feca0abded953add6c807c9f8c483a719fedcd7 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. elserj pushed a commit to branch branch-2 in repository https://gitbox.apache.org/repos/asf/hbase.git The following commit(s) were added to refs/heads/branch-2 by this push: new 2feca0a HBASE-22701 Disable the DynamicClassLoader when it fails to initialize 2feca0a is described below commit 2feca0abded953add6c807c9f8c483a719fedcd7 Author: Josh Elser AuthorDate: Tue Jul 16 17:10:27 2019 -0400 HBASE-22701 Disable the DynamicClassLoader when it fails to initialize Signed-off-by: Ankit Singhal --- .../hadoop/hbase/util/DynamicClassLoader.java | 31 ++++++++++++++++------ 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/DynamicClassLoader.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/DynamicClassLoader.java index 28fce21..e769e7f 100644 --- a/hbase-common/src/main/java/org/apache/hadoop/hbase/util/DynamicClassLoader.java +++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/util/DynamicClassLoader.java @@ -69,7 +69,10 @@ public class DynamicClassLoader extends ClassLoaderBase { private static final String DYNAMIC_JARS_OPTIONAL_CONF_KEY = "hbase.use.dynamic.jars"; private static final boolean DYNAMIC_JARS_OPTIONAL_DEFAULT = true; - private boolean useDynamicJars; + // The user-provided value for using the DynamicClassLoader + private final boolean userConfigUseDynamicJars; + // The current state of whether to use the DynamicClassLoader + private final boolean useDynamicJars; private File localDir; @@ -91,12 +94,23 @@ public class DynamicClassLoader extends ClassLoaderBase { final Configuration conf, final ClassLoader parent) { super(parent); - useDynamicJars = conf.getBoolean( + // Save off the user's original configuration value for the DynamicClassLoader + userConfigUseDynamicJars = conf.getBoolean( DYNAMIC_JARS_OPTIONAL_CONF_KEY, DYNAMIC_JARS_OPTIONAL_DEFAULT); - if (useDynamicJars) { - initTempDir(conf); + boolean dynamicJarsEnabled = userConfigUseDynamicJars; + if (dynamicJarsEnabled) { + try { + initTempDir(conf); + dynamicJarsEnabled = true; + } catch (Exception e) { + LOG.error("Disabling the DynamicClassLoader as it failed to initialize its temp directory." + + " Check your configuration and filesystem permissions. Custom coprocessor code may" + + " not be loaded as a result of this failure.", e); + dynamicJarsEnabled = false; + } } + useDynamicJars = dynamicJarsEnabled; } // FindBugs: Making synchronized to avoid IS2_INCONSISTENT_SYNC complaints about @@ -132,12 +146,13 @@ public class DynamicClassLoader extends ClassLoaderBase { try { return parent.loadClass(name); } catch (ClassNotFoundException e) { - if (LOG.isDebugEnabled()) { - LOG.debug("Class " + name + " not found - using dynamical class loader"); - } - if (useDynamicJars) { + LOG.debug("Class {} not found - using dynamical class loader", name); return tryRefreshClass(name); + } else if (userConfigUseDynamicJars) { + // If the user tried to enable the DCL, then warn again. + LOG.debug("Not checking DynamicClassLoader for missing class because it is disabled." + + " See the log for previous errors."); } throw e; }