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

             Summary: DelegationTokenRenewer.DelegationTokenCancelThread should 
use ExitUtil instead of System.exit
                 Key: YARN-12028
                 URL: https://issues.apache.org/jira/browse/YARN-12028
             Project: Hadoop YARN
          Issue Type: Improvement
          Components: resourcemanager
            Reporter: Jose Luis López


{{DelegationTokenRenewer.DelegationTokenCancelThread.run()}} catches 
{{IOException}}, {{RuntimeException}} and {{InterruptedException}} separately, 
and calls {{System.exit(-1)}} for anything else:
{code:java}
} catch (InterruptedException ie) {
  return;
} catch (Throwable t) {
  LOG.warn("Got exception " + StringUtils.stringifyException(t) +
           ". Exiting..");
  System.exit(-1);
}
{code}
Exiting the RM when this thread hits an {{Error}} is intentional (YARN-690), 
but calling {{System.exit}} directly bypasses {{ExitUtil}}:
* Tests that call {{ExitUtil.disableSystemExit()}} can't intercept it, so an 
{{Error}} thrown while cancelling a token in a test (for example an 
{{AssertionError}} from a mocked {{Token.cancel()}}) kills the surefire fork 
and the original failure is lost.
* It is inconsistent with the rest of the RM, which already exits through 
{{ExitUtil.terminate()}} (for example in {{ResourceManager}}).
* A fatal condition that terminates the RM is logged at WARN.

*Proposed fix:*
* Call {{ExitUtil.terminate(-1, t)}} instead of {{System.exit(-1)}}, keeping 
the exit behaviour from YARN-690.
* Log the throwable at ERROR.
* Add a test that an {{Error}} thrown while cancelling a token calls 
{{ExitUtil.terminate(-1, ...)}}.

Similar to HADOOP-20010 
({{AbstractDelegationTokenSecretManager.ExpiredTokenRemover}}) and HADOOP-20022 
({{SecurityUtil.doAsLoginUserOrFatal}}).



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