Uploaded image for project: 'Jira Software Data Center'
  1. Jira Software Data Center
  2. JSWSERVER-21417

Jira access token getting expired after 2 hours while connecting to Gitlab

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • High
    • 8.20.13, 9.3.0
    • 9.1.0, 8.20.11, 9.2.0, 8.22.6, 9.4.6, 9.4.14
    • DVCS Connector

    Description

      Description

      This ticket is a continuation of JSWSERVER-21389. Our team thought the problem was resolved, but later it appeared we ran in troubles with concurrency, that's why that one (JSWSERVER-21417) was created. We have decided to create second ticket because root cause is slightly different and it affects next released versions than it's mentioned in JSWSERVER-21389.

      Issue Summary

      This is reproducible on Data Center: (yes) 

      Steps to Reproduce

      • Install GitLab 15.0.
      • Connect Jira to GitLab 
      • Wait 2 hours
      • Try to perform full sync, this will fail intermittently

      Expected Results

      The token refresh should take place in the background and sync should work

      Actual Results

      The token expires and cannot be refreshed. Looks to be issue with threads in order to overwrite the new token.Below are the error logs

      2022-07-22 16:50:25,612+0000 ajp-nio-127.0.0.1-8009-exec-397 url: /rest/bitbucket/1.0/repository/705/fullsync; user: xxxxxxxxx TRACE xxxxxxxxx 1010x56004x1 1c71cnj 10.60.128.173 /rest/bitbucket/1.0/repository/705/fullsync [c.a.o.c.lib.token.DefaultTokenService] Got OAuth Provider response: [400], [{"error":"invalid_grant","error_description":"The provided authorization grant is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or was issued to another client."}
          ]
      2022-07-22 16:50:25,614+0000 ajp-nio-127.0.0.1-8009-exec-397 url: /rest/bitbucket/1.0/repository/705/fullsync; user: xxxxxxxxx DEBUG xxxxxxxxx 1010x56004x1 1c71cnj 10.60.128.173 /rest/bitbucket/1.0/repository/705/fullsync [c.a.j.p.d.gitlab.impl.OAuthTokenProviderImpl] Failed to get access token
      
      ...
      
      2022-07-22 16:51:46,322+0000 Caesium-1-2 DEBUG ServiceRunner     [c.a.j.p.d.gitlab.impl.AbstractGitLabRestClientImpl] Received response [GET https://gitlab.assist.zone/api/v4/users?search=xxxxxxx&per_page=100 returned a response status of 200 OK]
      2022-07-22 16:51:46,322+0000 Caesium-1-2 INFO ServiceRunner     [c.a.j.p.dvcs.service.RepositoryServiceImpl] Could not load user [xxxxxx, xxxxxxx]
      com.atlassian.jira.plugins.dvcs.exception.SourceControlException: java.lang.NullPointerException
      2022-07-25 13:08:06,585+0000 DVCSConnector.MessageExecutor:thread-48 DEBUG xxxxxxxxx 768x98182x1 10c6dyi 10.60.128.173 /rest/bitbucket/1.0/repository/846/fullsync [c.a.j.p.dvcs.event.ThreadEvents] There is no active ThreadEventsCaptor. Dropping event: DevSummaryChangedEvent{date=Mon Jul 25 13:08:06 UTC 2022, issueKeys=[DEP-512], repositoryId=846, dvcsType='gitlabselfmanaged'}
      
      2022-07-25 13:08:06,590+0000 DVCSConnector.MessageExecutor:thread-48 DEBUG xxxxxxxxxx 768x98182x1 10c6dyi 10.60.128.173 /rest/bitbucket/1.0/repository/846/fullsync [c.a.j.p.d.service.message.MessageConsumer] Could not acquire token for consumer: 'com.atlassian.jira.plugins.dvcs.sync.GitLabSynchronizeChangesetMessageConsumer@23319f60' with id 'com.atlassian.jira.plugins.dvcs.spi.gitlab.message.GitLabSynchronizeChangesetMessage'. There are already '2' threads processing the messages.
      
      mysql> select * from AO_723324_CLIENT_TOKEN \G
      *************************** 1. row ***************************
                  ACCESS_TOKEN: 3bb0d420b0f586f9f7b43aec2263572b46d70c1c7233451c329f1d250c75d049
       ACCESS_TOKEN_EXPIRATION: 1658509102379
                     CONFIG_ID: aef8a204-aa84-4085-babe-42cc67d5b37a
                            ID: 216a24ff-d0e9-4f7e-87d4-619e12d233dd
                LAST_REFRESHED: NULL
           LAST_STATUS_UPDATED: 1658753719903
                 REFRESH_COUNT: 0
                 REFRESH_TOKEN: acca34b4145b496b99c362715a2331f08a58fa4957d8601a7b1600570f8322f3
      REFRESH_TOKEN_EXPIRATION: 1661094301379
                        STATUS: UNRECOVERABLE
      

      Workaround

      Workaround is not very helpful because it consist in recreating GitLab integration after every 2 hours.

      Attachments

        Issue Links

          Activity

            People

              1c017edd2c81 awojtasik
              3814e4a56ec7 Aniket Ranjan
              Votes:
              14 Vote for this issue
              Watchers:
              36 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: