[ 
https://issues.apache.org/jira/browse/HADOOP-19966?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18105334#comment-18105334
 ] 

ASF GitHub Bot commented on HADOOP-19966:
-----------------------------------------

Copilot commented on code in PR #8688:
URL: https://github.com/apache/hadoop/pull/8688#discussion_r3797807178


##########
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/security/token/delegation/TestZKDelegationTokenSecretManager.java:
##########
@@ -551,22 +558,27 @@ public void testCreatingParentContainersIfNeeded() throws 
Exception {
         .build();
     curatorFramework.start();
     ZKDelegationTokenSecretManager.setCurator(curatorFramework);
-    DelegationTokenManager tm1 = new DelegationTokenManager(conf, new 
Text("foo"));
+    try {
+      DelegationTokenManager tm1 = new DelegationTokenManager(conf, new 
Text("foo"));
 
-    // When the init method is called,
-    // the ZKDelegationTokenSecretManager#startThread method will be called,
-    // and the creatingParentContainersIfNeeded will be called to create the 
nameSpace.
-    tm1.init();
+      // When the init method is called,
+      // the ZKDelegationTokenSecretManager#startThread method will be called,
+      // and the creatingParentContainersIfNeeded will be called to create the 
nameSpace.
+      tm1.init();

Review Comment:
   `tm1.destroy()` is only called on the success path; if `tm1.init()` or the 
ZK assertion throws, the secret manager threads may be left running and can 
make subsequent tests flaky. Put `tm1.destroy()` in a `finally` so cleanup 
always happens.
   
   This issue also appears on line 631 of the same file.





> ZKDelegationTokenSecretManager may fail to load tokens and keys from 
> ZooKeeper on startup
> -----------------------------------------------------------------------------------------
>
>                 Key: HADOOP-19966
>                 URL: https://issues.apache.org/jira/browse/HADOOP-19966
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Cheng Pan
>            Priority: Major
>              Labels: pull-request-available
>




--
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