瀏覽代碼

YARN-11384: NPE in DelegationTokenRenewer causes all subsequent apps to fail with "Timer already cancelled" (#7404) Contributed by Cheng Pan.

Reviewed-by: Shilun Fan <slfan1989@apache.org>
Signed-off-by: Shilun Fan <slfan1989@apache.org>
Cheng Pan 5 月之前
父節點
當前提交
06ff1b69c7

+ 6 - 3
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/DelegationTokenRenewer.java

@@ -807,10 +807,13 @@ public class DelegationTokenRenewer extends AbstractService {
   private void removeFailedDelegationToken(DelegationTokenToRenew t) {
     Collection<ApplicationId> applicationIds = t.referringAppIds;
     synchronized (applicationIds) {
-      LOG.error("removing failed delegation token for appid=" + applicationIds
-          + ";t=" + t.token.getService());
+      LOG.error("removing failed delegation token for appid={};t={}",
+          applicationIds, t.token.getService());
       for (ApplicationId applicationId : applicationIds) {
-        appTokens.get(applicationId).remove(t);
+        Set<DelegationTokenToRenew> tokens = appTokens.get(applicationId);
+        if (tokens != null && !tokens.isEmpty()) {
+          tokens.remove(t);
+        }
       }
     }
     allTokens.remove(t.token);