Jose Luis López created HADOOP-20022:
----------------------------------------
Summary: SecurityUtil.doAsLoginUserOrFatal should use ExitUtil
instead of Runtime.exit
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
{{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]