Uploaded image for project: 'Bitbucket Server'
  1. Bitbucket Server
  2. BSERV-12388

Loading a pull request's overview or diff can fail with a merge-base usage block

    XMLWordPrintable

    Details

      Description

      Issue Summary

      After certain types of forced updates to pull requests, it's possible (due to another bug, which remains undiagnosed) to end up with both the source and target branches on the pull request referencing the same commit. When that happens, the pull request becomes unviewable in the UI due to an error running git merge-base.

      Steps to Reproduce

      The exact steps to reproduce this are currently not known.

      Expected Results

      The pull request displays as empty, without errors.

      Actual Results

      An error popup is shown when viewing the overview or diff, indicating git merge-base failed. This same exception can also be triggered by comment drift processing in the background.

      This failure can produce a few different types of error messages, depending on what code path it's triggered from.

      Viewing the overview:

      2020-06-01 19:25:01,710 ERROR [http-nio-7990-exec-2] bturner @VOOHFTx1165x19227x4 1out6n0 1.1.1.1 "GET /rest/api/latest/projects/KEY/repos/slug/pull-requests/1/activities HTTP/1.1" c.a.b.s.g.c.GitCommandExitHandler [/usr/bin/git merge-base c026dc4711e759308af76c309d17583cc1289f78] The syntax used is incorrect. git exited and printed a usage block
      

      Running comment drift:

      2020-06-01 11:25:45,677 ERROR [drift:thread-3]  c.a.s.i.p.c.d.DriftCommentUpdateProcessor 1:1@2: Unrecoverable error calculating comment drift (1 attempts).
              First: 1:1@2 (dc510ef89b8679d30373cf7ba40c9532f6ec0a2f, c026dc4711e759308af76c309d17583cc1289f78) -> (c026dc4711e759308af76c309d17583cc1289f78, c026dc4711e759308af76c309d17583cc1289f78)
              Last: 1:1@2 (dc510ef89b8679d30373cf7ba40c9532f6ec0a2f, c026dc4711e759308af76c309d17583cc1289f78) -> (c026dc4711e759308af76c309d17583cc1289f78, c026dc4711e759308af76c309d17583cc1289f78)
      com.atlassian.bitbucket.scm.CommandUsageException: The syntax used for the command is incorrect.
              at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.checkUsage(GitCommandExitHandler.java:63)
              at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.evaluateStdErr(GitCommandExitHandler.java:69)
              at com.atlassian.stash.internal.scm.git.pull.PullRequestMergeBaseExitHandler.evaluateStdErr(PullRequestMergeBaseExitHandler.java:46)
              at com.atlassian.bitbucket.scm.git.command.GitCommandExitHandler.onError(GitCommandExitHandler.java:204)
              at com.atlassian.bitbucket.scm.DefaultCommandExitHandler.onExit(DefaultCommandExitHandler.java:32)
              at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.callExitHandler(NioNuProcessHandler.java:281)
              at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.finish(NioNuProcessHandler.java:322)
              at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.onExit(NioNuProcessHandler.java:123)
              at com.zaxxer.nuprocess.internal.BasePosixProcess.onExit(BasePosixProcess.java:319)
              at com.zaxxer.nuprocess.linux.ProcessEpoll.handleExit(ProcessEpoll.java:371)
              at com.zaxxer.nuprocess.linux.ProcessEpoll.cleanupProcess(ProcessEpoll.java:334)
              at com.zaxxer.nuprocess.linux.ProcessEpoll.process(ProcessEpoll.java:272)
              at com.zaxxer.nuprocess.internal.BaseEventProcessor.run(BaseEventProcessor.java:81)
              at com.zaxxer.nuprocess.linux.ProcessEpoll.run(ProcessEpoll.java:188)
              at com.zaxxer.nuprocess.linux.LinuxProcess.run(LinuxProcess.java:114)
              at com.zaxxer.nuprocess.linux.LinProcessFactory.runProcess(LinProcessFactory.java:50)
              at com.zaxxer.nuprocess.NuProcessBuilder.run(NuProcessBuilder.java:273)
              at com.atlassian.bitbucket.internal.process.nu.NuNioProcessHelper.run(NuNioProcessHelper.java:75)
              at com.atlassian.bitbucket.internal.process.NioCommand.call(NioCommand.java:52)
              at com.atlassian.stash.internal.scm.git.porcelain.AbstractTimedRequest.configureAndCall(AbstractTimedRequest.java:42)
              at com.atlassian.stash.internal.scm.git.pull.ShinyGitPullRequestPorcelain.findCommonAncestor(ShinyGitPullRequestPorcelain.java:67)
              at com.atlassian.stash.internal.scm.git.pull.DefaultPullRequestRefHelper$EffectiveDiffOperation.perform(DefaultPullRequestRefHelper.java:598)
              at com.atlassian.stash.internal.scm.git.pull.DefaultPullRequestRefHelper$EffectiveDiffOperation.perform(DefaultPullRequestRefHelper.java:571)
              at com.atlassian.stash.internal.scm.git.pull.DefaultPullRequestRefHelper$LockedOperation.perform(DefaultPullRequestRefHelper.java:667)
              at com.atlassian.stash.internal.concurrent.ClusterMappedLock.withLock(ClusterMappedLock.java:49)
              at com.atlassian.stash.internal.concurrent.ClusterPullRequestLock.withLock(ClusterPullRequestLock.java:25)
              at com.atlassian.stash.internal.scm.git.pull.DefaultPullRequestRefHelper.withLock(DefaultPullRequestRefHelper.java:460)
              at com.atlassian.stash.internal.scm.git.pull.DefaultPullRequestRefHelper.access$1200(DefaultPullRequestRefHelper.java:60)
              at com.atlassian.stash.internal.scm.git.pull.DefaultPullRequestRefHelper$LockedOperation.call(DefaultPullRequestRefHelper.java:647)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at io.atlassian.util.concurrent.ConcurrentOperationMapImpl$CallerRunsFuture.get(ConcurrentOperationMapImpl.java:67)
              at io.atlassian.util.concurrent.ConcurrentOperationMapImpl.runOperation(ConcurrentOperationMapImpl.java:55)
              at com.atlassian.stash.internal.scm.git.pull.DefaultPullRequestRefHelper.effectiveDiff(DefaultPullRequestRefHelper.java:119)
              at com.atlassian.stash.internal.scm.git.DefaultGitPullRequestCommandFactory$1.call(DefaultGitPullRequestCommandFactory.java:184)
              at com.atlassian.stash.internal.scm.git.DefaultGitPullRequestCommandFactory$1.call(DefaultGitPullRequestCommandFactory.java:180)
              at com.atlassian.stash.internal.pull.comment.drift.DriftCommentUpdateProcessor$CommentDriftCalculator.calculate(DriftCommentUpdateProcessor.java:314)
              at com.atlassian.stash.internal.pull.comment.drift.DriftCommentUpdateProcessor$CommentDriftOperation.lambda$perform$0(DriftCommentUpdateProcessor.java:493)
              at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:140)
              at com.atlassian.stash.internal.pull.comment.drift.DriftCommentUpdateProcessor$CommentDriftOperation.perform(DriftCommentUpdateProcessor.java:491)
              at com.atlassian.stash.internal.pull.comment.drift.DriftCommentUpdateProcessor$CommentDriftOperation.perform(DriftCommentUpdateProcessor.java:464)
              at com.atlassian.stash.internal.concurrent.ClusterMappedLock.withLock(ClusterMappedLock.java:49)
              at com.atlassian.stash.internal.concurrent.ClusterPullRequestLock.withLock(ClusterPullRequestLock.java:25)
              at com.atlassian.stash.internal.concurrent.ClusterPullRequestLock.withLock(ClusterPullRequestLock.java:30)
              at com.atlassian.stash.internal.pull.comment.drift.DriftCommentUpdateProcessor$CommentDriftBootstrapper.perform(DriftCommentUpdateProcessor.java:256)
              at com.atlassian.stash.internal.pull.comment.drift.DriftCommentUpdateProcessor$CommentDriftBootstrapper.perform(DriftCommentUpdateProcessor.java:241)
              at com.atlassian.stash.internal.user.DefaultEscalatedSecurityContext.call(DefaultEscalatedSecurityContext.java:59)
              at com.atlassian.stash.internal.pull.comment.drift.DriftCommentUpdateProcessor$CommentDriftBootstrapper.run(DriftCommentUpdateProcessor.java:262)
              at com.atlassian.stash.internal.concurrent.StateTransferringRunnable.run(StateTransferringRunnable.java:50)
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
              at java.util.concurrent.FutureTask.run(FutureTask.java:266)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
              at java.lang.Thread.run(Thread.java:748)
              ... 1 frame trimmed
      

      Workaround

      Push new commits to the pull request's source branch, to ensure it has commits that are on the source branch but not the target. Afterward, rescoping should automatically repair the pull request and it should be viewable again.

        Attachments

          Activity

            People

            Assignee:
            bturner Bryan Turner
            Reporter:
            bturner Bryan Turner
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: