You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Jonathan Hsieh (Commented) (JIRA)" <ji...@apache.org> on 2011/09/29 23:21:45 UTC

[jira] [Commented] (HBASE-4515) User.getCurrent() can cause NPE.

    [ https://issues.apache.org/jira/browse/HBASE-4515?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13117623#comment-13117623 ] 

Jonathan Hsieh commented on HBASE-4515:
---------------------------------------

A stack trace of the error that I'd like to avoid.

{code}
2011-09-29 11:38:45,823 ERROR [Thread-341] hbase.MiniHBaseCluster(201): Error starting cluster
java.lang.NullPointerException
	at org.apache.hadoop.hbase.security.User.getName(User.java:71)
	at org.apache.hadoop.hbase.HBaseTestingUtility.getDifferentUser(HBaseTestingUtility.java:1421)
	at org.apache.hadoop.hbase.MiniHBaseCluster.init(MiniHBaseCluster.java:191)
	at org.apache.hadoop.hbase.MiniHBaseCluster.<init>(MiniHBaseCluster.java:76)
	at org.apache.hadoop.hbase.MiniHBaseCluster.<init>(MiniHBaseCluster.java:61)
	at org.apache.hadoop.hbase.HBaseTestingUtility.restartHBaseCluster(HBaseTestingUtility.java:505)
	at org.apache.hadoop.hbase.util.hbck.TestOfflineMetaRebuild.testMetaRebuild(TestOfflineMetaRebuild.java:306)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.internal.runners.statements.FailOnTimeout$1.run(FailOnTimeout.java:28)
{code}
                
> 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
>
> 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