Java.IO.IOException: Access is Denied on Checkout Task.

Recently we migrated our bamboo install to a different Windows machine. We migrated the settings from our old bamboo install using the Export/Import in the admin area.

Now we're getting an exeception on the Code Checkout Task for all of our builds. We're using Bitbucket for hosting, and I've double-checked the credentials. I've also tried switching over a repository to the git@bitbucket.com URL and pointing to an SSH key, but we still get the same exception.

Looking into the stack trace, I think the issue might be with local filesystem permissions. But we're running bamboo under a local user account which has full control over the bamboo-home directory. So I'm just not sure where the error is.

We're using Bamboo v5.2 build 4003

Java version: 1.7.0_45

Windows 7.6.1

Here's the stack trace that bamboo spits out:

java.lang.RuntimeException: com.atlassian.bamboo.repository.RepositoryException: java.lang.RuntimeException: java.io.IOException: Access is denied
	at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:132)
	at com.atlassian.bamboo.executor.RetryingTaskExecutor.runTask(RetryingTaskExecutor.java:88)
	at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:191)
	at com.atlassian.bamboo.executor.RetryingTaskExecutor.retry(RetryingTaskExecutor.java:176)
	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager.collectionChangesWithRetry(DefaultChangeDetectionManager.java:470)
	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:207)
	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.tryStartChainState(ChainExecutionManagerImpl.java:260)
	at com.atlassian.bamboo.chains.ChainExecutionManagerImpl.delayedStart(ChainExecutionManagerImpl.java:196)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	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 com.sun.proxy.$Proxy99.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(Unknown Source)
Caused by: com.atlassian.bamboo.repository.RepositoryException: java.lang.RuntimeException: java.io.IOException: Access is denied
	at com.atlassian.bamboo.plugins.git.GitRepository.collectChangesSinceLastBuild(GitRepository.java:302)
	at com.atlassian.bamboo.plugins.git.GitRepository.collectChangesSinceLastBuild(GitRepository.java:203)
	at com.atlassian.bamboo.plugins.hg.BitbucketRepository.collectChangesSinceLastBuild(BitbucketRepository.java:297)
	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager$1.call(DefaultChangeDetectionManager.java:475)
	at com.atlassian.bamboo.v2.trigger.DefaultChangeDetectionManager$1.call(DefaultChangeDetectionManager.java:471)
	at com.atlassian.bamboo.executor.RetryingTaskExecutor.rerun(RetryingTaskExecutor.java:108)
	... 32 more
Caused by: com.google.common.util.concurrent.UncheckedExecutionException: java.lang.RuntimeException: java.io.IOException: Access is denied
	at com.google.common.cache.CustomConcurrentHashMap$ComputedUncheckedException.get(CustomConcurrentHashMap.java:3305)
	at com.google.common.cache.CustomConcurrentHashMap$ComputingValueReference.compute(CustomConcurrentHashMap.java:3441)
	at com.google.common.cache.CustomConcurrentHashMap$Segment.compute(CustomConcurrentHashMap.java:2322)
	at com.google.common.cache.CustomConcurrentHashMap$Segment.getOrCompute(CustomConcurrentHashMap.java:2291)
	at com.google.common.cache.CustomConcurrentHashMap.getOrCompute(CustomConcurrentHashMap.java:3802)
	at com.google.common.cache.ComputingCache.get(ComputingCache.java:46)
	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.checkGitExistenceInSystem(GitCommandProcessor.java:201)
	at com.atlassian.bamboo.plugins.git.NativeGitOperationHelper.<init>(NativeGitOperationHelper.java:82)
	at com.atlassian.bamboo.plugins.git.GitOperationHelperFactory.createGitOperationHelper(GitOperationHelperFactory.java:25)
	at com.atlassian.bamboo.plugins.git.GitRepository.collectChangesSinceLastBuild(GitRepository.java:213)
	... 37 more
Caused by: java.lang.RuntimeException: java.io.IOException: Access is denied
	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getSshScriptToRun(GitCommandProcessor.java:122)
	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.createCommandBuilder(GitCommandProcessor.java:442)
	at com.atlassian.bamboo.plugins.git.GitCommandProcessor$1.load(GitCommandProcessor.java:172)
	at com.atlassian.bamboo.plugins.git.GitCommandProcessor$1.load(GitCommandProcessor.java:166)
	at com.google.common.cache.CustomConcurrentHashMap$ComputingValueReference.compute(CustomConcurrentHashMap.java:3426)
	... 45 more
Caused by: java.io.IOException: Access is denied
	at java.io.WinNTFileSystem.createFileExclusively(Native Method)
	at java.io.File.createNewFile(Unknown Source)
	at com.atlassian.bamboo.util.BambooFileUtils.createSafeTempFile(BambooFileUtils.java:338)
	at com.atlassian.bamboo.util.SharedTemporaryFiles.createTempFile(SharedTemporaryFiles.java:43)
	at com.atlassian.bamboo.util.SharedTemporaryFiles.access$000(SharedTemporaryFiles.java:18)
	at com.atlassian.bamboo.util.SharedTemporaryFiles$1.load(SharedTemporaryFiles.java:31)
	at com.atlassian.bamboo.util.SharedTemporaryFiles$1.load(SharedTemporaryFiles.java:27)
	at com.google.common.cache.CustomConcurrentHashMap$ComputingValueReference.compute(CustomConcurrentHashMap.java:3426)
	at com.google.common.cache.CustomConcurrentHashMap$Segment.compute(CustomConcurrentHashMap.java:2322)
	at com.google.common.cache.CustomConcurrentHashMap$Segment.getOrCompute(CustomConcurrentHashMap.java:2291)
	at com.google.common.cache.CustomConcurrentHashMap.getOrCompute(CustomConcurrentHashMap.java:3802)
	at com.google.common.cache.ComputingCache.get(ComputingCache.java:46)
	at com.atlassian.bamboo.util.SharedTemporaryFiles.getFile(SharedTemporaryFiles.java:98)
	at com.atlassian.bamboo.util.BambooFileUtils.getSharedTemporaryFile(BambooFileUtils.java:623)
	at com.atlassian.bamboo.plugins.git.GitCommandProcessor.getSshScriptToRun(GitCommandProcessor.java:117)
	... 49 more
Any help someone can give would be great.

3 answers

1 accepted

The issue was that we were running Bamboo under a local user account, and needed to run it as administrator for it to work (since bamboo apparently needs access to both user files and Program Files), in addition Bamboo needed to be run as admin for the first run so it could do it's inital setup as admin.

Check to make sure that the permissions are correct on all sub-folders and that if any files have been inserted manually that those have also been corrected for permissions. A lot of times I've had issues where a root folder couldn't be created or where it was created but couldn't be updated because of the permissions not following through to the children. You might try deleting anything in the build-dir folder. Also check your config file to make sure that there aren't any paths that point to locations on the old file system that are no longer valid.

There are config files in your bamboo-home folder (not the folder with the apps but with the data. This has logs, plugins, templates, xml-data in it) bamboo.cfg.xml is a likely culprit. it has stuff like :

<property name="buildWorkingDir">${bambooHome}\xml-data\build-dir</property>

and if your ${bambooHome} isn't set or is set to an invalid directory that would cause a problem. I know ${bambooHome} is set during install but don't recall where to change it after install.

I'm probably being no help here, but I gave it a shot.

Might also be that the checkout user needs permission and doesn't have it OR that the bamboo user (that the service runs under) needs permissions and doesn't have it. Sometimes that bamboo user is a tricky fella so make sure both users have the correct permissions just to be sure.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Asked 6 hours ago in Confluence

What are the resources that you use to learn more about Atlassian Products?

I am gathering information about resources available for Atlassian product knowledge transferring for a presentation in our local Atlassian User Group. I want to group them in four categories From ...

52 views 3 3
View question

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you