Deepak Kumar Mishra, Support Engineer, EMEA TFS Team, brings this knowledge experience while working with one of his customers.. Read on
Recently I was working on an issue where the Git clone operation failed in a customer environment and while troubleshooting the Git Push operation also failed for a few users blocking Tfs operations Completely.
Git Clone Fails with inflate: data stream error (incorrect header check)
I checked in the event logs and found the following error:
TF53010: The following error has occurred in a Team Foundation component or extension:
Date (UTC): 10.02.2015 09:31:36
Application Domain: /LM/W3SVC/2/ROOT/tfs-1-130680223897599771
Assembly: Microsoft.TeamFoundation.Framework.Server, Version=188.8.131.52, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a; v4.0.30319
Service Host: b94ad55e-7e02-4335-a6d1-1c740d6fjeyud49 (Collection)
Process Name: w3wp
Process Id: 400
Thread Id: 56
Detailed Message: TF30065: An unhandled exception occurred.
Web Request Details
Url: http://tfs:8080/tfs/collectionname/_git/TeamProjname/git-receive-pack [method: POST]
User Agent: git/1.0 (Microsoft libgit2 Client 184.108.40.206)
Local Request: False
Host Address: 220.127.116.11
User: domain/xxxx [authentication type: NTLM]
Exception Message: TF14103: Internal error: The database procedure prc_WriteGitRefs returned the wrong number of rows. (type UnexpectedDatabaseResultException)
Exception Stack Trace: at Microsoft.TeamFoundation.Framework.Server.ResultCollection.NextResult()
at Microsoft.TeamFoundation.Git.Server.GitCoreComponent17.WriteRefs(String teamProjectUri, Guid repositoryId, Guid pusherId, IEnumerable`1 requests, IEnumerable`1 commitIdsInRefs, IEnumerable`1 commitParents, DateTime& pushTime, Int32& pushId)
at Microsoft.TeamFoundation.Git.Server.TfsGitRepositoryRefsCollection.Write(TeamFoundationRequestContext requestContext, IEnumerable`1 requests, Dictionary`2 commitIdsInRefs, DateTime& pushTime, Int32& pushId)
at Microsoft.TeamFoundation.Git.Server.TfsGitRepository.ApplyRefUpdates(TeamFoundationRequestContext requestContext, IGitPushReporter pushReporter, List`1 refUpdateRequests, Dictionary`2 includedCommitIds, List`1 allResults, DateTime& pushTime, Int32& pushId, IEnumerable`1& results)
It’s a corrupted packfile on the server (could have occurred in any number of ways, including hardware/network/etc issues)
After an extensive research I found the following solution. I would like to propose this solution to the above mentioned problem. Hope it helps.
In such situations the below mentioned workaround will help to fix the issue without causing any information loss(version history and links). However, before that we need to check the following things
Pre-requisites: Please create a new repo on the server and push the most recent copy of code from client repository to the newly created server repository. However, before doing that, please run 'git-fsck--verbose' command at client repository to make sure the integrity of the data in local repository(client) is maintained and we can identify if there are any corruptions in data. Also make sure cloning works from this new repository location after pushing the code.
If the above pre-requisites are satisfied, the following steps will get the user unblocked :
- Go to “Version control” project management tab by clicking on settings icon in the git team project web portal as shown below:
or directly browse to URL: http://tfs:8080/tfs/Collectionname/Teamprojectname/_admin/_versioncontrol
- Rename the old “Test-git” repository to “Test-git_Broken”
- Create a new repository called “Test-git”
- Mirror the bare clone to the local (bare) test git repository by running the following command from the folder which has the latest clone as mentioned in pre-requisites:
git push --mirror https://xxxx.tfs.com/DefaultCollection/_git/test-git
- After performing some tests, you can delete the “Test-git_Broken” repository.
In this way we would be able to preserve all the changes and links existing in the current repository and get back with normal Tfs operations.
Written by Deepak Kumar Mishra, Support Engineer
Reviewed by Nitish Nagpal, Support Escalation Engineer