Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-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 CE1FCF4F7 for ; Mon, 15 Apr 2013 20:37:42 +0000 (UTC) Received: (qmail 12829 invoked by uid 500); 15 Apr 2013 20:37:42 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 12700 invoked by uid 500); 15 Apr 2013 20:37:41 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 12688 invoked by uid 99); 15 Apr 2013 20:37:41 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Apr 2013 20:37:41 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 15 Apr 2013 20:37:39 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 6B5DF23888EA; Mon, 15 Apr 2013 20:37:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1468216 - /hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java Date: Mon, 15 Apr 2013 20:37:18 -0000 To: common-commits@hadoop.apache.org From: kihwal@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130415203718.6B5DF23888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kihwal Date: Mon Apr 15 20:37:17 2013 New Revision: 1468216 URL: http://svn.apache.org/r1468216 Log: HDFS-4690. Namenode exits if entering safemode while secret manager is edit logging. Contributed by Daryn Sharp. Modified: hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java Modified: hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java?rev=1468216&r1=1468215&r2=1468216&view=diff ============================================================================== --- hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java (original) +++ hadoop/common/branches/branch-0.23/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java Mon Apr 15 20:37:17 2013 @@ -84,6 +84,12 @@ extends AbstractDelegationTokenIdentifie private Thread tokenRemoverThread; protected volatile boolean running; + /** + * If the delegation token update thread holds this lock, it will + * not get interrupted. + */ + protected Object noInterruptsLock = new Object(); + public AbstractDelegationTokenSecretManager(long delegationKeyUpdateInterval, long delegationTokenMaxLifetime, long delegationTokenRenewInterval, long delegationTokenRemoverScanInterval) { @@ -364,12 +370,20 @@ extends AbstractDelegationTokenIdentifie } } - public synchronized void stopThreads() { + public void stopThreads() { if (LOG.isDebugEnabled()) LOG.debug("Stopping expired delegation token remover thread"); running = false; if (tokenRemoverThread != null) { - tokenRemoverThread.interrupt(); + synchronized (noInterruptsLock) { + tokenRemoverThread.interrupt(); + } + try { + tokenRemoverThread.join(); + } catch (InterruptedException e) { + throw new RuntimeException( + "Unable to join on token removal thread", e); + } } } @@ -397,7 +411,7 @@ extends AbstractDelegationTokenIdentifie rollMasterKey(); lastMasterKeyUpdate = now; } catch (IOException e) { - LOG.error("Master key updating failed: ", e); + LOG.error("Master key updating failed: " + e.getMessage()); } } if (lastTokenCacheCleanup + tokenRemoverScanInterval < now) {