Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 30DA518AE9 for ; Mon, 22 Feb 2016 17:07:53 +0000 (UTC) Received: (qmail 61483 invoked by uid 500); 22 Feb 2016 17:07:46 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 61439 invoked by uid 500); 22 Feb 2016 17:07:46 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 61427 invoked by uid 99); 22 Feb 2016 17:07:46 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 22 Feb 2016 17:07:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 94F87E03C2; Mon, 22 Feb 2016 17:07:46 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: thejas@apache.org To: commits@hive.apache.org Message-Id: <2266c79206b349939e5358c8848aebec@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: =?utf-8?q?hive_git_commit=3A_HIVE-13090_=3A_Hive_metastore_crashes?= =?utf-8?q?_on_NPE_with_ZooKeeperTokenStore_=28Piotr_Wikie=C5=82=2C_Thejas_N?= =?utf-8?q?air=2C_reviewed_by_Ashutosh_Chauhan=29?= Date: Mon, 22 Feb 2016 17:07:46 +0000 (UTC) Repository: hive Updated Branches: refs/heads/branch-1 5b0825f16 -> 0596951d2 HIVE-13090 : Hive metastore crashes on NPE with ZooKeeperTokenStore (Piotr Wikieł, Thejas Nair, reviewed by Ashutosh Chauhan) Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/0596951d Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/0596951d Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/0596951d Branch: refs/heads/branch-1 Commit: 0596951d2295cf42c63e88a0f805a3db0188b01b Parents: 5b0825f Author: Thejas Nair Authored: Mon Feb 22 09:06:56 2016 -0800 Committer: Thejas Nair Committed: Mon Feb 22 09:07:38 2016 -0800 ---------------------------------------------------------------------- .../org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java | 1 + .../hive/thrift/TokenStoreDelegationTokenSecretManager.java | 1 - .../java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java | 4 ++++ 3 files changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/0596951d/itests/hive-unit/src/test/java/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java ---------------------------------------------------------------------- diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java index 9848cc1..65a10e3 100644 --- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java +++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/thrift/TestZooKeeperTokenStore.java @@ -122,6 +122,7 @@ public class TestZooKeeperTokenStore extends TestCase { assertTrue(ts.removeToken(tokenId)); assertEquals(0, ts.getAllDelegationTokenIdentifiers().size()); + assertNull(ts.getToken(tokenId)); } public void testAclNoAuth() throws Exception { http://git-wip-us.apache.org/repos/asf/hive/blob/0596951d/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java ---------------------------------------------------------------------- diff --git a/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java b/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java index 8146d51..87b418e 100644 --- a/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java +++ b/shims/common/src/main/java/org/apache/hadoop/hive/thrift/TokenStoreDelegationTokenSecretManager.java @@ -330,7 +330,6 @@ public class TokenStoreDelegationTokenSecretManager extends DelegationTokenSecre } catch (Throwable t) { LOGGER.error("ExpiredTokenRemover thread received unexpected exception. " + t, t); - Runtime.getRuntime().exit(-1); } } } http://git-wip-us.apache.org/repos/asf/hive/blob/0596951d/shims/common/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java ---------------------------------------------------------------------- diff --git a/shims/common/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java b/shims/common/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java index 745e467..528e55d 100644 --- a/shims/common/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java +++ b/shims/common/src/main/java/org/apache/hadoop/hive/thrift/ZooKeeperTokenStore.java @@ -396,6 +396,10 @@ public class ZooKeeperTokenStore implements DelegationTokenStore { @Override public DelegationTokenInformation getToken(DelegationTokenIdentifier tokenIdentifier) { byte[] tokenBytes = zkGetData(getTokenPath(tokenIdentifier)); + if(tokenBytes == null) { + // The token is already removed. + return null; + } try { return HiveDelegationTokenSupport.decodeDelegationTokenInformation(tokenBytes); } catch (Exception ex) {