Jose Luis López created YARN-12002:
--------------------------------------

             Summary: RouterClientRMService does not stop the delegation token 
secret manager on service stop
                 Key: YARN-12002
                 URL: https://issues.apache.org/jira/browse/YARN-12002
             Project: Hadoop YARN
          Issue Type: Bug
          Components: router
            Reporter: Jose Luis López


{\{RouterClientRMService#serviceStart}} calls 
\{{routerDTSecretManager.startThreads()}}, which starts the 
\{{ExpiredTokenRemover}} daemon thread of 
\{{AbstractDelegationTokenSecretManager}}. \{{serviceStop}} never calls 
\{{stopThreads()}}, so the thread outlives the service. It keeps calling the 
\{{FederationStateStoreFacade}} to roll master keys and remove expired tokens 
even after the Router and everything it owns have stopped.

The ResourceManager already handles this: 
\{{RMSecretManagerService#serviceStop}} stops its delegation token secret 
manager's threads. The Router leaves this step out.

There is a second problem in the same method: \{{serviceStop}} throws a 
\{{NullPointerException}} if the service was initialized but never started, 
because \{{userPipelineMap}} is only created in \{{serviceStart}}:
{code}
userPipelineMap.clear();   // NPE when serviceStart() never ran
{code}

*Proposed fix*
* In \{{serviceStop}}, after the RPC server stops, call 
\{{routerDTSecretManager.stopThreads()}} if the secret manager is not null.
* Guard \{{userPipelineMap.clear()}} against null.

*Tests*
Two new tests in \{{TestRouterClientRMService}}:
* \{{testServiceStopStopsDelegationTokenSecretManager}}: after \{{stop()}}, the 
secret manager reports \{{isRunning() == false}}.
* \{{testServiceStopWithoutStart}}: a service that was initialized but never 
started reaches \{{STOPPED}} without an exception.

Both tests fail without the fix and pass with it.

This was split out of YARN-11984. The federation mock Router there closes the 
state store after the Router stops, so it depends on this thread having stopped.



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