Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-11511

Pull request merges fail with the "New changes were pushed to <branch> in <project>/<repository> while the merge was being performed. Please retry the merge." message

      Atlassian status as of November 2020

      Hi everyone,

      Thanks for voting and commenting on this bug. Your input in the comments helps us understand how this affects you and how to reproduce this issue.

      We fixed numerous subtle bugs in the rescoping process and this has resulted in a significant reduction of this problem in our internal environments. We encourage to upgrade to any of the fix versions mentioned in this ticket and provide feedback if the issues have been resolved.

      In addition, take a look at BSERV-Howtoself-serviceanddebugrescopingproblems-051120-0256.pdf for more information about what exactly has been fixed and ways to further diagnose and fix this class of problems.

      Cheers,
      Wolfgang Kritzinger

      Senior Developer - Bitbucket Server

      Issue Summary

      When merging a pull request, the user received the following message:

      New changes were pushed to <branch> in <project>/<repository> while the merge was being performed. Please retry the merge.
      

      While this is expected when a change occurs on the target branch during the merge, this can occur also when no changes are received.

      Steps to Reproduce

      This has been noticed in busy environments.

      Expected Results

      The merge completes successfully.

      Actual Results

      The merge does not complete.

      There are no exception in the logs, this message is only logged at debug level

      com.atlassian.bitbucket.scm.MergeException: New changes were pushed to <branch> in <project>/<repository> while the merge was being performed. Please retry the merge
      

      Workaround

      Decline and reopen the pull request before attempting to merge again.

            [BSERV-11511] Pull request merges fail with the "New changes were pushed to <branch> in <project>/<repository> while the merge was being performed. Please retry the merge." message

            In addition, take a look at BSERV-Howtoself-serviceanddebugrescopingproblems-051120-0256.pdf for more information about what exactly has been fixed and ways to further diagnose and fix this class of problems.

            At the end of that article, the part at the end - Temporary resolution for “un-mergeable” pull requests - does not work in Bitbucket 7.21. It redirects from /projects to /rest/api/1.0/projects and then returns a 404 error with no explanation as to why.

            Richard Cross added a comment - In addition, take a look at BSERV-Howtoself-serviceanddebugrescopingproblems-051120-0256.pdf for more information about what exactly has been fixed and ways to further diagnose and fix this class of problems. At the end of that article, the part at the end - Temporary resolution for “un-mergeable” pull requests - does not work in Bitbucket 7.21. It redirects from /projects to /rest/api/1.0/projects and then returns a 404 error with no explanation as to why.

            happening in 8.7.1

            Hamdy Atakora added a comment - happening in 8.7.1

            Happening with v7.21.4

            Manuel Torrinha added a comment - Happening with v7.21.4

            I experience this daily at work.

            Anthony Post added a comment - I experience this daily at work.

            This happened to us in v7.21.12 this morning. Workaround of declining and re-opening the PR worked. Please advise.

            Adam Raitanen added a comment - This happened to us in v7.21.12 this morning. Workaround of declining and re-opening the PR worked. Please advise.

            We were hit with this on v7.17.1.

            The scenario was two attempted PR merges close together.
            First one completed normally.

            On the second one:
            1. the merge failed with

            New changes were pushed to <branch> in <repo> while the merge was being performed. Please retry the merge.
            

            2. The diff if the second PR started showing the commits of the first PR. So when <branch> updated from aaaa to bbbb, the displayed diff still rendered to the previous HEAD aaaa.
            3. Further merge attempt failed with same error message.

            eero-aaltonen added a comment - We were hit with this on v7.17.1. The scenario was two attempted PR merges close together. First one completed normally. On the second one: 1. the merge failed with New changes were pushed to <branch> in <repo> while the merge was being performed. Please retry the merge. 2. The diff if the second PR started showing the commits of the first PR. So when <branch> updated from aaaa to bbbb , the displayed diff still rendered to the previous HEAD aaaa . 3. Further merge attempt failed with same error message.

            Thank you @Brian Turner

            Sethuraman Narayanan added a comment - Thank you @Brian Turner

            senaraya1031012202,

            We'll see what we find. That said, please note that it's entirely possible for the error you're seeing to occur "for real". For example, if two people merge pull requests targeting the same branch "concurrently" (where "concurrently" doesn't have to be perfectly aligned; since merges take time to process, the window can vary), one of them will correctly get this error message because both of their merges can't possibly succeed. For busy repositories, that can happen frequently. There is also an unavoidable delay between when a push (or other operation) updates a given branch and when the system updates pull requests for that ref. The more open pull requests an instance has, the longer that delay can end up being.

            Regardless, thanks for opening the ticket, and hopefully we can get down to the root cause!

            Best regards,
            Bryan Turner
            Atlassian Bitbucket

            Bryan Turner (Inactive) added a comment - senaraya1031012202 , We'll see what we find. That said, please note that it's entirely possible for the error you're seeing to occur "for real". For example, if two people merge pull requests targeting the same branch "concurrently" (where "concurrently" doesn't have to be perfectly aligned; since merges take time to process, the window can vary), one of them will correctly get this error message because both of their merges can't possibly succeed. For busy repositories, that can happen frequently. There is also an unavoidable delay between when a push (or other operation) updates a given branch and when the system updates pull requests for that ref. The more open pull requests an instance has, the longer that delay can end up being. Regardless, thanks for opening the ticket, and hopefully we can get down to the root cause! Best regards, Bryan Turner Atlassian Bitbucket

            @Bryan Turner: i will be opening up a support case but just that you know we noticed similar issue with 7.6.1 too. 

            Caused by: com.atlassian.bitbucket.scm.git.command.push.GitNonFastForwardUpdateRejectedException: The merge could not be completed because the target ref was updated mid-merge.

            Sethuraman Narayanan added a comment - @Bryan Turner: i will be opening up a support case but just that you know we noticed similar issue with 7.6.1 too.  Caused by: com.atlassian.bitbucket.scm.git.command.push.GitNonFastForwardUpdateRejectedException: The merge could not be completed because the target ref was updated mid-merge.

            @Bryan Turner
            thanks for this clear statement. We will plan the upgrade to 7.6. This takes a while but if we see that the problem is solve we will inform you.

            Thomas Beck added a comment - @Bryan Turner thanks for this clear statement. We will plan the upgrade to 7.6. This takes a while but if we see that the problem is solve we will inform you.

              Unassigned Unassigned
              ccurti Caterina Curti
              Affected customers:
              43 This affects my team
              Watchers:
              62 Start watching this issue

                Created:
                Updated:
                Resolved: