You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by ma...@apache.org on 2012/05/07 07:46:54 UTC
svn commit: r1334876 - in /hadoop/common/branches/branch-1: CHANGES.txt
src/core/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
src/test/org/apache/hadoop/hdfs/security/TestDelegationToken.java
Author: mattf
Date: Mon May 7 05:46:53 2012
New Revision: 1334876
URL: http://svn.apache.org/viewvc?rev=1334876&view=rev
Log:
HDFS-3374. TestDelegationToken fails intermittently with a race condition. Contributed by Owen O'Malley.
Modified:
hadoop/common/branches/branch-1/CHANGES.txt (contents, props changed)
hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
hadoop/common/branches/branch-1/src/test/org/apache/hadoop/hdfs/security/TestDelegationToken.java
Modified: hadoop/common/branches/branch-1/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/CHANGES.txt?rev=1334876&r1=1334875&r2=1334876&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/CHANGES.txt (original)
+++ hadoop/common/branches/branch-1/CHANGES.txt Mon May 7 05:46:53 2012
@@ -314,6 +314,9 @@ Release 1.0.3 - unreleased
HADOOP-8151. Error handling in snappy decompressor throws invalid
exceptions. (Matt Foley)
+ HDFS-3374. hdfs' TestDelegationToken fails intermittently with a race
+ condition. (Owen O'Malley via mattf)
+
Release 1.0.2 - 2012.03.24
NEW FEATURES
Propchange: hadoop/common/branches/branch-1/CHANGES.txt
------------------------------------------------------------------------------
Merged /hadoop/common/branches/branch-1.0/CHANGES.txt:r1334875
Modified: hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java?rev=1334876&r1=1334875&r2=1334876&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java (original)
+++ hadoop/common/branches/branch-1/src/core/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java Mon May 7 05:46:53 2012
@@ -381,24 +381,30 @@ extends AbstractDelegationTokenIdentifie
while (running) {
long now = System.currentTimeMillis();
if (lastMasterKeyUpdate + keyUpdateInterval < now) {
- try {
- rollMasterKey();
- lastMasterKeyUpdate = now;
- } catch (IOException e) {
- LOG.error("Master key updating failed. "
- + StringUtils.stringifyException(e));
+ synchronized (AbstractDelegationTokenSecretManager.this) {
+ if (running) {
+ try {
+ rollMasterKey();
+ lastMasterKeyUpdate = now;
+ } catch (IOException e) {
+ LOG.error("Master key updating failed. "
+ + StringUtils.stringifyException(e));
+ }
+ }
}
}
if (lastTokenCacheCleanup + tokenRemoverScanInterval < now) {
- removeExpiredToken();
- lastTokenCacheCleanup = now;
+ synchronized (AbstractDelegationTokenSecretManager.this) {
+ if (running) {
+ removeExpiredToken();
+ lastTokenCacheCleanup = now;
+ }
+ }
}
try {
Thread.sleep(5000); // 5 seconds
} catch (InterruptedException ie) {
- LOG
- .error("InterruptedExcpetion recieved for ExpiredTokenRemover thread "
- + ie);
+ return;
}
}
} catch (Throwable t) {
Modified: hadoop/common/branches/branch-1/src/test/org/apache/hadoop/hdfs/security/TestDelegationToken.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-1/src/test/org/apache/hadoop/hdfs/security/TestDelegationToken.java?rev=1334876&r1=1334875&r2=1334876&view=diff
==============================================================================
--- hadoop/common/branches/branch-1/src/test/org/apache/hadoop/hdfs/security/TestDelegationToken.java (original)
+++ hadoop/common/branches/branch-1/src/test/org/apache/hadoop/hdfs/security/TestDelegationToken.java Mon May 7 05:46:53 2012
@@ -69,13 +69,18 @@ public class TestDelegationToken {
cluster.waitActive();
cluster.getNameNode().getNamesystem().getDelegationTokenSecretManager()
.startThreads();
+ LOG.info("cluster up and running");
}
@After
public void tearDown() throws Exception {
+ LOG.info("starting shutting down the cluster");
if(cluster!=null) {
+ cluster.getNameNode().getNamesystem().getDelegationTokenSecretManager()
+ .stopThreads();
cluster.shutdown();
}
+ LOG.info("finished shutting down the cluster");
}
private Token<DelegationTokenIdentifier> generateDelegationToken(