Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Frequent errors running TFS-2013 with git

Tags:

git

tfsbuild

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..?

like image 333
cacau Avatar asked Mar 07 '14 07:03

cacau


2 Answers

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.

like image 71
VonC Avatar answered Oct 01 '22 20:10

VonC


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.

like image 40
Mike Makarov Avatar answered Oct 01 '22 18:10

Mike Makarov