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

Alexander Kolbasov commented on SENTRY-1718:
--------------------------------------------

Here is the code that creates a static user. It is in the 
{{UserGroupInformation}} class:

{code}
  /**
   * Return the current user, including any doAs in the current stack.
   * @return the current user
   * @throws IOException if login fails
   */
  public synchronized
  static UserGroupInformation getCurrentUser() throws IOException {
    AccessControlContext context = AccessController.getContext();
    Subject subject = Subject.getSubject(context);
    if (subject == null || subject.getPrincipals(User.class).isEmpty()) {
      return getLoginUser();
    } else {
      return new UserGroupInformation(subject);
    }
  }
{code}

we go through {{getLoginUser()}} code path whwich is:

{code}
  static UserGroupInformation getLoginUser() throws IOException {
    if (loginUser == null) {
      loginUserFromSubject(null);
    }
    return loginUser;
  }
{code}
  static UserGroupInformation getLoginUser() throws IOException {
    if (loginUser == null) {
      loginUserFromSubject(null);
    }
    return loginUser;
  }
{code}

and loginUser is a static variable:

{code}
  /**
   * Information about the logged in user.
   */
  private static UserGroupInformation loginUser = null;
{code}

> 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