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

Merging a pull request using a rebase strategy can time out

    XMLWordPrintable

    Details

      Description

      Issue Summary

      Attempting to merge a pull request using one of the "rebase" merge strategies ("Rebase and merge" or "Rebase fast-forward") can time out when there are no files in the top-level of the target branch and the first file is encountered within a subdirectory more than 1 level deep.

      Steps to Reproduce

      There is an issue (since Bitbucket Server 7.0) in the way the work tree is constructed for rebase merges under some fairly specific conditions (specifically when the pull request target doesn't contain any files, only directories, at the top-level of the directory structure, and the first file is encountered within a subdirectory more than 1 level deep, for example as shown in the image below).

      Expected Results

      The pull request should be merged.

      Actual Results

      The merge attempt times out after the default timeout period (the default setting is 5 minutes).

      The below exception is thrown in the application log file:

      2020-05-29 17:49:40,464 DEBUG [http-nio-6710-exec-8] Bitbucket @1HY4IEJx1059x477x0 5x902v 0:0:0:0:0:0:0:1 "POST /rest/api/latest/projects/SSP/repos/develop/pull-requests/1/merge HTTP/1.1" c.a.s.i.r.e.ServiceExceptionMapper Mapping ServiceException to REST response 500
      com.atlassian.bitbucket.ServerException: An error occurred while executing an external process: process timed out
      	at 
      com.atlassian.stash.internal.scm.git.porcelain.AbstractTimedRequest.configureAndCall(AbstractTimedRequest.java:42)
      	at com.atlassian.stash.internal.scm.git.porcelain.ShinyGitPorcelain.checkout(ShinyGitPorcelain.java:216)
      	at com.atlassian.stash.internal.scm.git.porcelain.ShinyGitPorcelain.lambda$workTree$0(ShinyGitPorcelain.java:154)
      	at java.base/java.util.Optional.ifPresent(Optional.java:176)
      	at com.atlassian.stash.internal.scm.git.porcelain.ShinyGitPorcelain.workTree(ShinyGitPorcelain.java:148)
      	at com.atlassian.stash.internal.scm.git.merge.MergeCommand.call(MergeCommand.java:72)
      	at com.atlassian.stash.internal.scm.git.merge.MergeCommand.call(MergeCommand.java:37)
      	at com.atlassian.stash.internal.pull.DefaultPullRequestService$MergePullRequestOperation.perform(DefaultPullRequestService.java:2278)
      	at com.atlassian.stash.internal.pull.DefaultPullRequestService.merge(DefaultPullRequestService.java:830)
      ...
      Caused by: com.atlassian.utils.process.ProcessTimeoutException: process timed out
      	at com.atlassian.bitbucket.internal.process.nu.NioNuProcessHandler.callExitHandler(NioNuProcessHandler.java:270)
      	... 72 common frames omitted
      

      Workaround

      A few different workarounds are available:

      1) Try using a different merge strategy for merging the pull request (for example "Merge commit --no-ff" or "Squash --squash")

      2) Add one or more files to the top-level of the target directory, for example as shown in the image:

      3) Disable NIO handling by setting process.nio.enabled=false in bitbucket.properties and restart the server.

      Warning: Support for disabling NIO handling will be removed in a future version, so after upgrading to a fixed version the process.nio.enabled=false setting should be removed.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              fdoherty@atlassian.com Frank Doherty
              Reporter:
              fdoherty@atlassian.com Frank Doherty
              Votes:
              3 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: