Jose Luis López created HADOOP-20011:
----------------------------------------

             Summary: Release token managers and Curator clients in finally 
blocks in TestZKDelegationTokenSecretManager
                 Key: HADOOP-20011
                 URL: https://issues.apache.org/jira/browse/HADOOP-20011
             Project: Hadoop Common
          Issue Type: Test
          Components: security
            Reporter: Jose Luis López


Most tests in {{TestZKDelegationTokenSecretManager}} and its RBF subclass 
{{TestZKDelegationTokenSecretManagerImpl}} release their 
{{DelegationTokenManager}} instances, secret managers and Curator clients only 
on the success path. When an assertion fails, these resources leak.

A leaked manager's {{ExpiredTokenRemover}} keeps running after {{tearDown()}} 
closes the ZooKeeper {{TestingServer}}. It then fails with {{ConnectionLoss}} 
while a later test is running, so the next test fails or the surefire fork is 
killed, and the original failure is lost (see HADOOP-20010). A leaked 
thread-local curator set via {{ZKDelegationTokenSecretManager.setCurator}} can 
also leak into later tests.

*Proposed fix:* move cleanup into try/finally blocks, with null-safe destroys, 
in:
* {{TestZKDelegationTokenSecretManager}}: {{testMultiNodeOperationsImpl}}, 
{{testNodeUpAferAWhile}}, {{testMultiNodeCompeteForSeqNum}}, 
{{testRenewTokenSingleManager}}, {{testCancelTokenSingleManager}}, 
{{testStopThreads}}, {{testACLs}} and {{testCreateNameSpaceRepeatedly}}.
* {{TestZKDelegationTokenSecretManagerImpl}}: the three {{*WithoutWatch}} tests.

Already covered elsewhere, so not touched here:
* {{testNodesLoadedAfterRestart}} (HADOOP-20009).
* {{testCreatingParentContainersIfNeeded}} and {{testMultipleInit}} 
(HADOOP-19966, [PR #8688|https://github.com/apache/hadoop/pull/8688]).

Test-only change. Most of the diff is re-indentation; review with whitespace 
ignored.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to