HDFS-3374, new synchronization in AbstractDelegationTokenSecretManager.ExpiredTokenRemover was added to make sure the ExpiredTokenRemover thread can be interrupted in time. Otherwise TestDelegation fails intermittently because the MiniDFScluster thread could be shut down before tokenRemover thread.
However, as Todd pointed out in
HDFS-3374, a potential deadlock was introduced by its patch:
- FSNamesystem.saveNamespace (holding FSN lock) calls DTSM.saveSecretManagerState (which takes DTSM lock)
- ExpiredTokenRemover.run (holding DTSM lock) calls rollMasterKey calls updateCurrentKey calls logUpdateMasterKey which takes FSN lock
So if there is a concurrent saveNamespace at the same tie as the expired token remover runs, it might make the NN deadlock.
This JIRA is to track the change of removing the possible deadlock from AbstractDelegationTokenSecretManager.