YARN-5353. ResourceManager can leak delegation tokens when they are shared across apps. (Jason Lowe via Varun Saxena).
This commit is contained in:
parent
82c3c66dcb
commit
dc3e077301
|
@ -773,7 +773,7 @@ public class DelegationTokenRenewer extends AbstractService {
|
|||
|
||||
private void removeApplicationFromRenewal(ApplicationId applicationId) {
|
||||
rmContext.getSystemCredentialsForApps().remove(applicationId);
|
||||
Set<DelegationTokenToRenew> tokens = appTokens.get(applicationId);
|
||||
Set<DelegationTokenToRenew> tokens = appTokens.remove(applicationId);
|
||||
|
||||
if (tokens != null && !tokens.isEmpty()) {
|
||||
synchronized (tokens) {
|
||||
|
@ -798,15 +798,10 @@ public class DelegationTokenRenewer extends AbstractService {
|
|||
// cancel the token
|
||||
cancelToken(dttr);
|
||||
|
||||
it.remove();
|
||||
allTokens.remove(dttr.token);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(tokens != null && tokens.isEmpty()) {
|
||||
appTokens.remove(applicationId);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1254,6 +1254,9 @@ public class TestDelegationTokenRenewer {
|
|||
Assert.assertTrue(dttr.referringAppIds.isEmpty());
|
||||
Assert.assertTrue(dttr.isTimerCancelled());
|
||||
Assert.assertTrue(Renewer.cancelled);
|
||||
|
||||
// make sure the token also has been removed from appTokens
|
||||
Assert.assertFalse(renewer.getDelegationTokens().contains(token1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue