Plan configured to checkout from Git repository stay queued for a long time
Symptoms
When the plan is triggered, the job will stay queued for a long time (5-30 minutes), before eventually starting – even though there are available agents.
Analysing the Bamboo server thread dumps, this can be seen:
"3-DelayedChangeDetectionThread:pool-6-thread-158" prio=10 tid=0x00007fd424075000 nid=0x4011 runnable [0x00007fd2d95d3000]
java.lang.Thread.State: RUNNABLE
at org.shaded.eclipse.jgit.storage.file.PackFile.idx(PackFile.java:154)
- locked <0x00000006850fc6c0> (a org.shaded.eclipse.jgit.storage.file.PackFile)
at org.shaded.eclipse.jgit.storage.file.PackFile.get(PackFile.java:226)
at org.shaded.eclipse.jgit.storage.file.ObjectDirectory.openObject1(ObjectDirectory.java:439)
at org.shaded.eclipse.jgit.storage.file.FileObjectDatabase.openObjectImpl1(FileObjectDatabase.java:172)
at org.shaded.eclipse.jgit.storage.file.FileObjectDatabase.openObject(FileObjectDatabase.java:157)
at org.shaded.eclipse.jgit.storage.file.WindowCursor.open(WindowCursor.java:122)
at org.shaded.eclipse.jgit.treewalk.CanonicalTreeParser.reset(CanonicalTreeParser.java:193)
at org.shaded.eclipse.jgit.treewalk.CanonicalTreeParser.createSubtreeIterator0(CanonicalTreeParser.java:227)
at org.shaded.eclipse.jgit.treewalk.CanonicalTreeParser.createSubtreeIterator(CanonicalTreeParser.java:205)
at org.shaded.eclipse.jgit.treewalk.CanonicalTreeParser.createSubtreeIterator(CanonicalTreeParser.java:60)
at org.shaded.eclipse.jgit.treewalk.TreeWalk.enterSubtree(TreeWalk.java:907)
at org.shaded.eclipse.jgit.treewalk.TreeWalk.next(TreeWalk.java:566)
at org.shaded.eclipse.jgit.diff.DiffEntry.scan(DiffEntry.java:146)
at org.shaded.eclipse.jgit.diff.DiffEntry.scan(DiffEntry.java:114)
at com.atlassian.bamboo.plugins.git.JGitOperationHelper.extractCommits(JGitOperationHelper.java:667)
at com.atlassian.bamboo.plugins.git.GitRepository$2.get(GitRepository.java:247)
at com.atlassian.bamboo.plugins.git.GitRepository$2.get(GitRepository.java:241)
at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:303)
at com.atlassian.bamboo.plugins.git.GitRepository.collectChangesSinceLastBuild(GitRepository.java:240)
at com.atlassian.bamboo.plugins.git.GitRepository.collectChangesSinceLastBuild(GitRepository.java:186)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectionChangesWithRetry(DefaultChangeDetectionManager.java:466)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceLastBuildInternal(DefaultChangeDetectionManager.java:331)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:259)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectChangesSinceRevisions(DefaultChangeDetectionManager.java:161)
at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectAllChangesSinceLastBuild(DefaultChangeDetectionManager.java:127)
at com.atlassian.bamboo.v2.trigger.ManualBuildDetectionAction.performDelayedChangeDetection(ManualBuildDetectionAction.java:173)
at com.atlassian.bamboo.chains.ChainExecutionManagerImpl$2.getChainState(ChainExecutionManagerImpl.java:206)
at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:259)
at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:195)
at sun.reflect.GeneratedMethodAccessor1860.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:304)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy97.delayedStart(Unknown Source)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:383)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1$1.call(PlanExecutionManagerImpl.java:378)
at com.atlassian.util.concurrent.ManagedLocks$ManagedLockImpl.withLock(ManagedLocks.java:312)
at com.atlassian.bamboo.plan.PlanExecutionLockServiceImpl.lock(PlanExecutionLockServiceImpl.java:81)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.doWithProcessLock(PlanExecutionManagerImpl.java:725)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl.access$200(PlanExecutionManagerImpl.java:123)
at com.atlassian.bamboo.plan.PlanExecutionManagerImpl$1$1.run(PlanExecutionManagerImpl.java:377)
at com.atlassian.bamboo.build.pipeline.concurrent.NamedThreadFactory$2.run(NamedThreadFactory.java:55)
at java.lang.Thread.run(Thread.java:722)
Locked ownable synchronizers:
- 0x0000000659b70300> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
- 0x000000067fd9f7d8> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
Cause
The default jgit
library is being used to run git commands. This is not very matured and its most likely to be the root cause.
Resolution
Make sure that a native Git client is installed in the Bamboo server and add it as an executable capability. This will make Bamboo use the native Git client configured instead of jgit
.