We have TFS-2013 configured to use a git repository. All works fine most of the time but we are getting intermittent build errors - they even seem to become more frequent over time.
This is what we can find in the build logs when the problem occurs:
Exception Message: An error was raised by libgit2. Category = Os (Error).
Could not remove directory. File 'C:/Builds/1/MyTool/MyTool_CI/src/.git/objects/pack/pack_git2_a02380' cannot be removed: The process cannot access the file because it is being used by another process.
(type LibGit2SharpException)
Exception Data Dictionary:
libgit2.code = -1
libgit2.category = 1
What could cause these errors..?
This seems to be a bug in progress, as seen by this thread:
Can you repaire your VS2013 RTM and try again? Also, you can can see event viewer to see if there any useful info or have a try on other machines as I mentioned above.
I noticed that when the issue happens, Process Explorer shows the open file handles from TFSBuildServiceHost. Restarting the service appears to be a workaround.
We never had this issue before we introduced several builds for different branches within one repository. Then one day the build failed with exception:
Exception Message: Attempted to access an unloaded AppDomain. (type AppDomainUnloadedException)
Exception Stack Trace:
Server stack trace:
at LibGit2Sharp.Core.NativeMethods.git_clone(RepositorySafeHandle& repo, String origin_url, FilePath workdir_path, GitCloneOptions& opts)
at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts)
at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options)
at Microsoft.TeamFoundation.Build.Activities.Git.GitPull.GitClone.GetRepository(String repositoryUrl, String workingFolder, Boolean checkoutSubmodules)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
After this the issue started appearing from time to time until I restarted TfsBuildServiceHost. TFS 2013 U4.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With