Jenkins Checkout Failing using Bitbucket Source Branch Plugin

I hope I phrased this well. Our pipeline is a Jenkins multi branch pipeline and the git repo is Bitbucket. We recently started experiencing an issue, where the pipeline was taking too long to checkout a branch and as a result it ended up failing with this error message below. Please note however that this repo also has sub-modules.

plugins.git.GitException: Command "git checkout -f 0929da101bdb476560b50e3f903e55ea0e1ebfd6" returned status code 128:
stdout:
stderr: Terminated
fatal: the remote end hung up unexpectedly

at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2848)
at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:3178)
Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to devworngbld06
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1916)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:384)
at hudson.remoting.Channel.call(Channel.java:1108)
at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.execute(RemoteGitImpl.java:155)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler.invoke(RemoteGitImpl.java:140)
at PluginClassLoader for git-client/jdk.proxy23/jdk.proxy23.$Proxy206.execute(Unknown Source)
at PluginClassLoader for git//jenkins.plugins.git.MergeWithGitSCMExtension.checkout(MergeWithGitSCMExtension.java:144)
at PluginClassLoader for git//jenkins.plugins.git.MergeWithGitSCMExtension.decorateRevisionToBuild(MergeWithGitSCMExtension.java:110)
at PluginClassLoader for git//hudson.plugins.git.GitSCM.determineRevisionToBuild(GitSCM.java:1161)
at PluginClassLoader for git//hudson.plugins.git.GitSCM._checkout(GitSCM.java:1311)
at PluginClassLoader for git//hudson.plugins.git.GitSCM.checkout(GitSCM.java:1277)
at PluginClassLoader for workflow-scm-step//org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:136)
at PluginClassLoader for workflow-scm-step//org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:101)
at PluginClassLoader for workflow-scm-step//org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:88)
at PluginClassLoader for workflow-step-api//org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:49)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
Caused: hudson.plugins.git.GitException: Could not checkout 0929da101bdb476560b50e3f903e55ea0e1ebfd6
at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.CliGitAPIImpl$9.execute(CliGitAPIImpl.java:3206)
at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:173)
at PluginClassLoader for git-client//org.jenkinsci.plugins.gitclient.RemoteGitImpl$CommandInvocationHandler$GitCommandMasterToSlaveCallable.call(RemoteGitImpl.java:164)
at hudson.remoting.UserRequest.perform(UserRequest.java:225)
at hudson.remoting.UserRequest.perform(UserRequest.java:50)
at hudson.remoting.Request$2.run(Request.java:391)
at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:81)
Caused: java.io.IOException
at PluginClassLoader for git//hudson.plugins.git.GitSCM.checkout(GitSCM.java:1279)
at PluginClassLoader for workflow-scm-step//org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:136)
at PluginClassLoader for workflow-scm-step//org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:101)
at PluginClassLoader for workflow-scm-step//org.jenkinsci.plugins.workflow.steps.scm.SCMStep$StepExecutionImpl.run(SCMStep.java:88)
at PluginClassLoader for workflow-step-api//org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:49)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Retrying after 10 seconds
ERROR: Timeout after 90 minutes
The recommended git tool is: NONE
using credential Remi_Watlow_BB_token
Fetching changes from the remote Git repository
Cleaning workspace
> git rev-parse --resolve-git-dir /home/jenkins/builds/workspace/EPM_build_PR-1202/.git # timeout=90
> git config remote.origin.url https://bitbucket.watlow.com/scm/nex/nextgen_fw_s1_head_core.git # timeout=90
> git rev-parse --verify HEAD # timeout=90
No valid HEAD. Skipping the resetting
> git clean -ffdx # timeout=90
Fetching upstream changes from https://bitbucket.watlow.com/scm/nex/nextgen_fw_s1_head_core.git
> git --version # timeout=90
> git --version # 'git version 2.43.0'
using GIT_ASKPASS to set credentials Remi Watlow BB token
> git fetch --no-tags --force --progress -- https://bitbucket.watlow.com/scm/nex/nextgen_fw_s1_head_core.git +refs/heads/hotfix/ACA-2632-epm-vs-6000-mass-flow-and-group-mkt-values-not-matching:refs/remotes/origin/hotfix/ACA-2632-epm-vs-6000-mass-flow-and-group-mkt-values-not-matching +refs/heads/eur-nextgen_V1.0:refs/remotes/origin/eur-nextgen_V1.0 # timeout=60
Merging remotes/origin/eur-nextgen_V1.0 commit 09d06f9ff7ff06ec9562e8b80bf6e6adadc34cdb into PR head commit 0929da101bdb476560b50e3f903e55ea0e1ebfd6
> git config core.sparsecheckout # timeout=90
> git checkout -f 0929da101bdb476560b50e3f903e55ea0e1ebfd6 # timeout=90
ERROR: Checkout failed
hudson.plugins.git.GitException: Command "git checkout -f 0929da101bdb476560b50e3f903e55ea0e1ebfd6" returned status code 128:
stdout:
stderr: Terminated
fatal: the remote end hung up unexpectedly

My colleague came up with a temporary fix by doing this

I have managed to “fix” PRs by going onto the server manually, cloning the repository + submodules using SSH, switching the remote back to HTTPS and starting the build. At this point, the build succeeds.

Do you know how we can resolve the issue permanently?

Jenkins setup:

1 Like

I’m running into the very same issue. Bitbucket repo with a public github submodule. Weirdly, even setting “Advanced sub-modules behaviours > Disable submodules processing” doesn’t make any difference.

I’m not aware of a solution :frowning: