YARN-3857: Memory leak in ResourceManager with SIMPLE mode. Contributed by mujunchao.
This commit is contained in:
parent
fc509f66d8
commit
3a76a010b8
@ -827,6 +827,9 @@ Release 2.7.2 - UNRELEASED
|
|||||||
|
|
||||||
YARN-3999. RM hangs on draing events. (Jian He via xgong)
|
YARN-3999. RM hangs on draing events. (Jian He via xgong)
|
||||||
|
|
||||||
|
YARN-3857: Memory leak in ResourceManager with SIMPLE mode.
|
||||||
|
(mujunchao via zxu)
|
||||||
|
|
||||||
Release 2.7.1 - 2015-07-06
|
Release 2.7.1 - 2015-07-06
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
@ -1309,9 +1309,11 @@ public void transition(RMAppAttemptImpl appAttempt,
|
|||||||
|
|
||||||
// register the ClientTokenMasterKey after it is saved in the store,
|
// register the ClientTokenMasterKey after it is saved in the store,
|
||||||
// otherwise client may hold an invalid ClientToken after RM restarts.
|
// otherwise client may hold an invalid ClientToken after RM restarts.
|
||||||
appAttempt.rmContext.getClientToAMTokenSecretManager()
|
if (UserGroupInformation.isSecurityEnabled()) {
|
||||||
.registerApplication(appAttempt.getAppAttemptId(),
|
appAttempt.rmContext.getClientToAMTokenSecretManager()
|
||||||
appAttempt.getClientTokenMasterKey());
|
.registerApplication(appAttempt.getAppAttemptId(),
|
||||||
|
appAttempt.getClientTokenMasterKey());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.crypto.SecretKey;
|
import javax.crypto.SecretKey;
|
||||||
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
|
|
||||||
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
|
||||||
import org.apache.hadoop.yarn.security.client.BaseClientToAMTokenSecretManager;
|
import org.apache.hadoop.yarn.security.client.BaseClientToAMTokenSecretManager;
|
||||||
@ -61,4 +62,10 @@ public synchronized SecretKey getMasterKey(
|
|||||||
ApplicationAttemptId applicationAttemptID) {
|
ApplicationAttemptId applicationAttemptID) {
|
||||||
return this.masterKeys.get(applicationAttemptID);
|
return this.masterKeys.get(applicationAttemptID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@VisibleForTesting
|
||||||
|
public synchronized boolean hasMasterKey(
|
||||||
|
ApplicationAttemptId applicationAttemptID) {
|
||||||
|
return this.masterKeys.containsKey(applicationAttemptID);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1393,6 +1393,38 @@ public void testGetClientToken() throws Exception {
|
|||||||
Assert.assertNull(token);
|
Assert.assertNull(token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// this is to test master key is saved in the secret manager only after
|
||||||
|
// attempt is launched and in secure-mode
|
||||||
|
@Test
|
||||||
|
public void testApplicationAttemptMasterKey() throws Exception {
|
||||||
|
Container amContainer = allocateApplicationAttempt();
|
||||||
|
ApplicationAttemptId appid = applicationAttempt.getAppAttemptId();
|
||||||
|
boolean isMasterKeyExisted = false;
|
||||||
|
|
||||||
|
// before attempt is launched, can not get MasterKey
|
||||||
|
isMasterKeyExisted = clientToAMTokenManager.hasMasterKey(appid);
|
||||||
|
Assert.assertFalse(isMasterKeyExisted);
|
||||||
|
|
||||||
|
launchApplicationAttempt(amContainer);
|
||||||
|
// after attempt is launched and in secure mode, can get MasterKey
|
||||||
|
isMasterKeyExisted = clientToAMTokenManager.hasMasterKey(appid);
|
||||||
|
if (isSecurityEnabled) {
|
||||||
|
Assert.assertTrue(isMasterKeyExisted);
|
||||||
|
Assert.assertNotNull(clientToAMTokenManager.getMasterKey(appid));
|
||||||
|
} else {
|
||||||
|
Assert.assertFalse(isMasterKeyExisted);
|
||||||
|
}
|
||||||
|
|
||||||
|
applicationAttempt.handle(new RMAppAttemptEvent(applicationAttempt
|
||||||
|
.getAppAttemptId(), RMAppAttemptEventType.KILL));
|
||||||
|
assertEquals(YarnApplicationAttemptState.LAUNCHED,
|
||||||
|
applicationAttempt.createApplicationAttemptState());
|
||||||
|
sendAttemptUpdateSavedEvent(applicationAttempt);
|
||||||
|
// after attempt is killed, can not get MasterKey
|
||||||
|
isMasterKeyExisted = clientToAMTokenManager.hasMasterKey(appid);
|
||||||
|
Assert.assertFalse(isMasterKeyExisted);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFailedToFailed() {
|
public void testFailedToFailed() {
|
||||||
// create a failed attempt.
|
// create a failed attempt.
|
||||||
|
Loading…
Reference in New Issue
Block a user