[
https://issues.apache.org/jira/browse/HBASE-4515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13117688#comment-13117688
]
Gary Helmling commented on HBASE-4515:
--------------------------------------
I think the key issue here is differences in behavior between non-secure
Hadoop's {{UserGroupInformation.getCurrentUGI()}} and secure Hadoop's
{{UserGroupInformation.getCurrentUser()}}. In secure Hadoop, if the current
user is {{null}}, it will perform an implicit login and use the subject
retrieved through that as the current user. In non-secure Hadoop (0.20.2,
0.20-append), the login step is completely separate, so if the current user has
not been set, only {{null}} will be returned.
For HBase purposes, I think we should make sure {{User.getCurrent()}} always
performs the implicit login for consistent behavior. Let me post an alternate
patch that takes that approach and see if it fixes your test problem.
> User.getCurrent() can cause NPE.
> --------------------------------
>
> Key: HBASE-4515
> URL: https://issues.apache.org/jira/browse/HBASE-4515
> Project: HBase
> Issue Type: Bug
> Affects Versions: 0.92.0, 0.94.0
> Reporter: Jonathan Hsieh
> Assignee: Jonathan Hsieh
> Attachments: 0001-HBASE-4515-User.getCurrent-can-cause-NPE.patch
>
>
> When testing with miniclusters that shutdown and are restarted, sometimes a
> call to User.getCurrent().getName() NPEs when attempting to restart hbase.
> Oddly this happens consistently on particular branches and not on others. I
> don't know or understand why this happens but it has something to do with the
> getCurrentUGI call in o.a.h.h.security.User.HadoopUser sometimes returning
> null and sometimes returning data.
> {code}
> private HadoopUser() {
> try {
> ugi = (UserGroupInformation) callStatic("getCurrentUGI");
> if (ugi == null) {
> LOG.warn("Although successfully retrieved UserGroupInformation"
> + " it was null!");
> }
> } catch (RuntimeException re) {
> {code}
> This patch essentially is a workaround -- it propagates the null so that
> clients can check and avoid the NPE.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira