[ 
https://issues.apache.org/jira/browse/HADOOP-20022?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Siyao Meng updated HADOOP-20022:
--------------------------------
    Fix Version/s: 3.6.0
       Resolution: Fixed
           Status: Resolved  (was: Patch Available)

> 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
>             Fix For: 3.6.0
>
>
> {{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]

Reply via email to