diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/DelegationTokenRenewer.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/DelegationTokenRenewer.java index d8368eb6482..62c8c6298b2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/DelegationTokenRenewer.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/DelegationTokenRenewer.java @@ -965,12 +965,8 @@ public void run() { } } - DelegationTokenRenewerAppRecoverEvent event = - new DelegationTokenRenewerAppRecoverEvent( - evt.getApplicationId(), evt.getCredentials(), - evt.shouldCancelAtEnd(), evt.getUser(), evt.getTokenConf()); - event.setAttempt(evt.getAttempt()); - processDelegationTokenRenewerEvent(event); + evt.setAttempt(evt.getAttempt()); + processDelegationTokenRenewerEvent(evt); } }; } @@ -1017,6 +1013,15 @@ public void run() { "Exhausted max retry attempts {} in token renewer " + "thread for {}", tokenRenewerThreadRetryMaxAttempts, evt.getApplicationId()); + if (evt instanceof DelegationTokenRenewerAppSubmitEvent) { + // Sending APP_REJECTED is fine, since we assume that the + // RMApp is in NEW state and thus we haven't yet informed the + // Scheduler about the existence of the application + rmContext.getDispatcher().getEventHandler().handle( + new RMAppEvent(evt.getApplicationId(), + RMAppEventType.APP_REJECTED, + "Exhausted max retry attempts for submitted new application. ")); + } } } } catch (Exception e) { @@ -1076,13 +1081,16 @@ private void handleDTRenewerAppSubmitEvent( .handle(new RMAppEvent(event.getApplicationId(), RMAppEventType.START)); } catch (Throwable t) { LOG.warn( - "Unable to add the application to the delegation token renewer.", + "Unable to add the application to the delegation token renewer," + + " will retry in delegationTokenRenewerPool.", t); + //If not TimeOut, should reject the app. + // Sending APP_REJECTED is fine, since we assume that the - // RMApp is in NEW state and thus we havne't yet informed the + // RMApp is in NEW state and thus we haven't yet informed the // Scheduler about the existence of the application rmContext.getDispatcher().getEventHandler().handle( - new RMAppEvent(event.getApplicationId(), + new RMAppEvent(evt.getApplicationId(), RMAppEventType.APP_REJECTED, t.getMessage())); } }