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

Na Li commented on SENTRY-1718:
-------------------------------

The provider does not create static state. it is in its constructor, 

private UserProvider() throws IOException {
        this.user = UserGroupInformation.getCurrentUser();  <- the returned 
user is static. That holds the credential.
        this.credentials = this.user.getCredentials();
    }

   public static synchronized UserGroupInformation getCurrentUser() throws 
IOException {
        AccessControlContext context = AccessController.getContext();
        Subject subject = Subject.getSubject(context);
        return subject != null && 
!subject.getPrincipals(User.class).isEmpty()?new 
UserGroupInformation(subject):getLoginUser(); <-- it returns login user for 
some case
    }

    @Public
    @Evolving
    public static synchronized UserGroupInformation getLoginUser() throws 
IOException {
        if(loginUser == null) {
            loginUserFromSubject((Subject)null);    
        }

        return loginUser;  <-- this is static
    }

> TestSentryStore often fails in setup()
> --------------------------------------
>
>                 Key: SENTRY-1718
>                 URL: https://issues.apache.org/jira/browse/SENTRY-1718
>             Project: Sentry
>          Issue Type: Sub-task
>          Components: Sentry
>    Affects Versions: sentry-ha-redesign
>            Reporter: Alexander Kolbasov
>            Assignee: Na Li
>             Fix For: sentry-ha-redesign
>
>         Attachments: SENTRY-1718.001-sentry-ha-redesign.patch, 
> SENTRY-1718.001-sentry-ha-redesign.patch, 
> SENTRY-1718.002-sentry-ha-redesign.patch
>
>
> Recent builds of sentry ha often fail with failures similar to this:
> {code}
> Running org.apache.sentry.provider.db.service.persistent.TestSentryStore
> Tests run: 58, Failures: 1, Errors: 1, Skipped: 0, Time elapsed: 43.213 sec 
> <<< FAILURE! - in 
> org.apache.sentry.provider.db.service.persistent.TestSentryStore
> testPrivilegesWithPermUpdate(org.apache.sentry.provider.db.service.persistent.TestSentryStore)
>   Time elapsed: 0.195 sec  <<< FAILURE!
> java.lang.AssertionError: expected:<2012> but was:<2>
>         at 
> org.apache.sentry.provider.db.service.persistent.TestSentryStore.testPrivilegesWithPermUpdate(TestSentryStore.java:2707)
> org.apache.sentry.provider.db.service.persistent.TestSentryStore  Time 
> elapsed: 0.14 sec  <<< ERROR!
> java.io.IOException: Credential sentry.store.jdbc.password already exists in 
> user:///
>         at 
> org.apache.sentry.provider.db.service.persistent.TestSentryStore.setup(TestSentryStore.java:97)
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to