You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by GitBox <gi...@apache.org> on 2021/03/11 15:21:31 UTC

[GitHub] [hadoop] steveloughran commented on a change in pull request #1894: HADOOP-16819 Possible inconsistent state of AbstractDelegationTokenSecretManager

steveloughran commented on a change in pull request #1894:
URL: https://github.com/apache/hadoop/pull/1894#discussion_r592451348



##########
File path: hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
##########
@@ -356,16 +356,14 @@ private void updateCurrentKey() throws IOException {
     int newCurrentId;
     synchronized (this) {
       newCurrentId = incrementCurrentKeyId();
-    }
-    DelegationKey newKey = new DelegationKey(newCurrentId, System
-        .currentTimeMillis()
-        + keyUpdateInterval + tokenMaxLifetime, generateSecret());
-    //Log must be invoked outside the lock on 'this'
-    logUpdateMasterKey(newKey);
-    synchronized (this) {
-      currentKey = newKey;
+      currentKey = new DelegationKey(newCurrentId, System
+          .currentTimeMillis()
+          + keyUpdateInterval + tokenMaxLifetime, generateSecret());
+
       storeDelegationKey(currentKey);
     }
+    //Log must be invoked outside the lock on 'this'
+    logUpdateMasterKey(currentKey);

Review comment:
       so this is now happening after the store? And both generateSecret and store are now synchronized?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org