[
https://issues.apache.org/jira/browse/HADOOP-20022?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18131304#comment-18131304
]
ASF GitHub Bot commented on HADOOP-20022:
-----------------------------------------
smengcl commented on PR #8827:
URL: https://github.com/apache/hadoop/pull/8827#issuecomment-6380404938
Thanks @joseluisll for the patch. Thanks @ayushtkn for the review.
> 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
> Assignee: 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
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]