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

DVCS Synchronization Enters Infinite Loop Due to Queued Messages for Deleted Branches

      Issue Summary

      DVCS Synchronization Enters Infinite Loop Due to Queued Messages for Deleted Branches

      This is reproducible on Data Center: (yes)

      Steps to Reproduce

      1. Set up a Jira instance with DVCS functionality enabled, using version 10.2.0 or later. (bulk sync was added in this version).
      2. Configure a DVCS repository with multiple branches, including some that will be deleted after initial synchronization.
      3. Initiate a manual soft synchronization to queue messages for all branch heads.
      4. Delete one of the branches in the GitHub repository after the initial synchronization. It's important that the branch is deleted from the repository after the message is created, but before the message queue processes it.

      Expected Results

      • Jira should detect the deleted branch and remove or invalidate any queued messages related to it.
      • The synchronization process should complete successfully for all existing branches without errors.

      Actual Results

      • Jira attempts to process the message for the deleted branch, resulting in repeated failures and retries.
      • The synchronization process for the affected repository does not complete successfully. In the UI we can confirm this by observing that the affected repositoriy is just spinning infinitely.
      • The logs will become spammed with very frequent 404 messages for the deleted branch.

      The below exception is thrown in the atlassian-jira.log file:

      2025-03-06 07:35:36,866+0000 DVCSConnector.MessageExecutor:thread-1 WARN      [c.a.j.p.dvcs.sync.BulkCommitsMessageConsumer] An Not Found (404) exception occurred when obtaining changeset range
      org.eclipse.egit.github.core.client.NoSuchPageException: Not Found (404)
      	at org.eclipse.egit.github.core.client.PageIterator.next(PageIterator.java:180)
      	at com.atlassian.jira.plugins.dvcs.spi.github.CustomCommitService.getChangesetPollResultForBranch(CustomCommitService.java:83)
      	at com.atlassian.jira.plugins.dvcs.spi.github.GithubCommunicator.getChangesetsRangeForBranch(GithubCommunicator.java:372)
      	at com.atlassian.jira.plugins.dvcs.service.remote.CachingCommunicator.getChangesetsRangeForBranch(CachingCommunicator.java:168)
      	at com.atlassian.jira.plugins.dvcs.service.remote.DvcsCommunicatorWithStatsImpl.getChangesetsRangeForBranch(DvcsCommunicatorWithStatsImpl.java:156)
      	at com.atlassian.jira.plugins.dvcs.sync.BulkCommitsMessageConsumer.onReceive(BulkCommitsMessageConsumer.java:75)
      	at com.atlassian.jira.plugins.dvcs.service.MessageExecutor$MessageRunnable.doRun(MessageExecutor.java:368)
      	at com.atlassian.jira.plugins.dvcs.service.MessageExecutor$ReleaseTokenAndEnqueueNextMessage.run(MessageExecutor.java:277)
      	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
      	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
      	at java.base/java.lang.Thread.run(Thread.java:840)
      Caused by: org.eclipse.egit.github.core.client.RequestException: Not Found (404)
      	at org.eclipse.egit.github.core.client.GitHubClient.createException(GitHubClient.java:622)
      	at org.eclipse.egit.github.core.client.GitHubClient.get(GitHubClient.java:815)
      	at com.atlassian.jira.plugins.dvcs.spi.github.GithubClientWithTimeout.lambda$get$0(GithubClientWithTimeout.java:77)
      	at com.atlassian.jira.plugins.dvcs.spi.github.GithubClientWithTimeout.executeRequest(GithubClientWithTimeout.java:113)
      	at com.atlassian.jira.plugins.dvcs.spi.github.GithubClientWithTimeout.get(GithubClientWithTimeout.java:77)
      	at org.eclipse.egit.github.core.client.PageIterator.next(PageIterator.java:178)
      	... 10 more
      

      Workaround 1: Force stop the affected repositories.

      Force Stop and Sync Affected Repositories: Manually abort the running synchronization for the affected repositories and initiate a forced synchronization.

      • Use a curl command or Postman to send a POST request to Jira's internal API endpoint. This request will abort any running synchronization for the specified repository.
      • API Endpoint:
        POST <JIRA_BASE_URL>/rest/dvcs-connector-internal/1.0/repository/{id}/abortRunningSync
        
      • Example curl Command:
        curl -X POST -u your-username\:your-api-token \
        '<JIRA_BASE_URL>/rest/dvcs-connector-internal/1.0/repository/{id}/abortRunningSync'
        

      This will abort the runing sync for the affected repository. Do note that this is a hard stop. Data that was queued to be processed is also dropped. On next soft sync the data should be queued again and synced properly.

      Workaround 2: Revert to Previous Sync Mechanism

      The bulk commit sync feature in Jira 10.2.0 has a dark feature flag dvcs.connector.github.bulk.commit.soft.sync.disabled that can be toggled to revert to the previous, slower sync mechanism. This can help avoid the infinite loop issue caused by messages for deleted branches.

      Steps:

      1. Access dark feature management using the [Atlassian guide](https://confluence.atlassian.com/jirakb/how-to-manage-dark-features-in-jira-server-and-data-center-959286331.html).
      2. Add dark feature dvcs.connector.github.bulk.commit.soft.sync.disabled

      Future syncs will now work using the older single commit sync mechanisms.

          Form Name

            [JSWSERVER-26329] DVCS Synchronization Enters Infinite Loop Due to Queued Messages for Deleted Branches

            Domenico Corniola made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 1005474 ]
            Jira Server Release Automation Bot[ADM-107524] made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Waiting for Release [ 12075 ] New: Closed [ 6 ]
            Nitesh Giri made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 1000037 ]
            Nitesh Giri made changes -
            Fix Version/s New: 10.3.5 [ 110896 ]
            Nitesh Giri made changes -
            Status Original: In Progress [ 3 ] New: Waiting for Release [ 12075 ]
            Nitesh Giri made changes -
            Status Original: Short Term Backlog [ 12074 ] New: In Progress [ 3 ]
            David Di Blasio made changes -
            Remote Link New: This issue links to "Page (Confluence)" [ 998686 ]
            SET Analytics Bot made changes -
            UIS Original: 1 New: 17
            SET Analytics Bot made changes -
            UIS New: 1
            SET Analytics Bot made changes -
            Support reference count Original: 1 New: 2

              7e8b5dfc9af0 Nitesh Giri
              ddiblasio David Di Blasio
              Affected customers:
              3 This affects my team
              Watchers:
              8 Start watching this issue

                Created:
                Updated:
                Resolved: