[
https://issues.apache.org/jira/browse/HADOOP-20022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18127448#comment-18127448
]
ASF GitHub Bot commented on HADOOP-20022:
-----------------------------------------
joseluisll closed pull request #8826: HADOOP-20022. Use ExitUtil instead of
Runtime.exit in SecurityUtil.doAsLoginUserOrFatal
URL: https://github.com/apache/hadoop/pull/8826
> Use ExitUtil instead of Runtime.exit in SecurityUtil.doAsLoginUserOrFatal
> -------------------------------------------------------------------------
>
> Key: HADOOP-20022
> URL: https://issues.apache.org/jira/browse/HADOOP-20022
> Project: Hadoop Common
> Issue Type: Improvement
> Components: security
> Reporter: Jose Luis López
> Priority: Minor
> Labels: pull-request-available
>
> {{SecurityUtil.doAsLoginUserOrFatal()}} calls
> {{Runtime.getRuntime().exit(-1)}} when
> {{UserGroupInformation.getLoginUser()}} throws an {{IOException}}:
> {code:java}
> try {
> ugi = UserGroupInformation.getLoginUser();
> } catch (IOException e) {
> LOG.error("Exception while getting login user", e);
> e.printStackTrace();
> Runtime.getRuntime().exit(-1);
> }
> {code}
> After HADOOP-20010 this is the only non-test caller of
> {{Runtime.getRuntime().exit(-1)}} in hadoop-common. It bypasses {{ExitUtil}},
> so tests that call {{ExitUtil.disableSystemExit()}} can't intercept it and
> the JVM is killed instead.
> Callers include {{ZKFailoverController}}, {{SecondaryNameNode}},
> {{BootstrapStandby}}, {{EditLogTailer}} and {{StandbyCheckpointer}}.
> *Proposed fix:*
> * Call {{ExitUtil.terminate(-1, e)}} instead of
> {{Runtime.getRuntime().exit(-1)}}.
> * Drop the redundant {{e.printStackTrace()}}; the exception is already logged.
> * Add a test that a {{getLoginUser()}} failure with security enabled calls
> {{ExitUtil.terminate(-1, ...)}}.
> Raised in review of HADOOP-20010 (https://github.com/apache/hadoop/pull/8805).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]