Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled Exception : System.AccessViolationException when cloning from TFS with 0.30 #1281

Closed
ananimesh opened this issue May 24, 2019 · 16 comments

Comments

@ananimesh
Copy link

ananimesh commented May 24, 2019

I am trying to clone my tfs repo using the clone command. Towards the end I get the error below

image

I am using version 0.30. When I use version 0.29, I don't see this issue.

This appears to happen after the last changeset has been cloned.
Could the latest updates to LibGit2Sharp in 0.30 have anything to do with this?

TFS version being used is 2017.

@NolanWoods
Copy link

I'm also encountering this error. I'm trying to clone just the first changeset in our repo, prior to setting some extra config before fetching the rest of the history. Using an invocation like git tfs clone --up-to=%FirstChangeSet% --gitignore=%GitIgnoreFile% %TfsUrl% "%TfsBase%/Main" Main, I got the same error:

Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
      at LibGit2Sharp.Core.NativeMethods.git_odb_free(git_odb* odb)
      at LibGit2Sharp.Core.Handles.Libgit2Object.Dispose(Boolean disposing)
      at LibGit2Sharp.Core.Handles.Libgit2Object.Finalize()

The exception didn't happen all the time, and at first seemed like it had something to do with changing my gitignore. Then I discovered changing the command line (usage of env. variables, name of the local repo, presence of -d, etc.) also affected it, and not in any way predictably.

The exception occurred in 51/85 invocations that I recorded, sometimes with the same command succeeding five times in a row before failing. I couldn't figure out if there were any clear patterns of behaviour, nor if it was truly random.

Also, the content added to %APPDATA%\Local\git-tfs\git-tfs_log.txt did not vary between successful clonings and clonings with this error.

I've been using 0.29 for the past couple weeks trying to migrate a messy TFS history, and haven't seen this error until trying 0.30 today.

@rbeurskens
Copy link

This happened to me when trying to fetch changesets from a TFS branch that was deleted and then recreated in the TFS history.
git-tfs version 0.30.0.0 (TFS client library 14.0.0.0 (MS)) (64-bit)

@theta682
Copy link

In my case, I have this exception each time I do git tfs fetch. It happens at the "Cleaning" stage after history successfully migrated. So, it looks like fetch succeeded, but gracefull stop fails. I had no such issue with version 0.29.0.

@morton-josh
Copy link

morton-josh commented Jun 18, 2019

I'm getting the exception every time I run "git tfs checkintool". Despite the exception, the TFS changeset is successfully created. This is a recent change so I think this is specific to version 0.30.

@pmiossec
Copy link
Member

I have opened an issue in the libgit2sharp project as it seems to be a problem with the last version released.

We will see what answers we could get from them.

libgit2/libgit2sharp#1691

@Boogier
Copy link

Boogier commented Jul 31, 2019

I've got the same issue today with git-tfs version 0.30.0.0 (TFS client library 14.0.0.0 (MS)) (64-bit)
when executing "git-tfs fetch".

If I add --debug switch the error does not happen.

@morton-josh
Copy link

Thanks @Boogier! the "--debug" switch fixed the "git tfs checkintool" command for me.

@pviotti
Copy link

pviotti commented Oct 30, 2019

I got a very similar error with version 0.30 while performing a git tfs fetch --debug --ignore-not-init-branches.

Unhandled Exception: System.AccessViolationException
at LibGit2Sharp.Core.NativeMethods.git_odb_free(git_odb* odb)    
at LibGit2Sharp.Core.Handles.Libgit2Object.Dispose(Boolean disposing)
at LibGit2Sharp.Repository.CleanupDisposableDependencies()    
at GitTfs.Core.GitRepository.Finalize()

Downgrading to 0.29.0 seems to have fixed the issue.

@galsi
Copy link

galsi commented Dec 4, 2019

Latest Git-Tfs & latest libgit2sharp - compiled locally solved the problem

pmiossec added a commit to pmiossec/git-tfs that referenced this issue Dec 4, 2019
hoping it solves some exception happening:
git-tfs#1281 (comment)
@pmiossec
Copy link
Member

pmiossec commented Dec 4, 2019

Latest Git-Tfs & latest libgit2sharp - compiled locally solved the problem

Great! Thanks.

So I have updated the lib #1309

For those that want to test the result, you could try the development version built there:
https://ci.appveyor.com/project/pmiossec/git-tfs-v2qcm/build/artifacts

@galsi
Copy link

galsi commented Dec 5, 2019

Latest Git-Tfs & latest libgit2sharp - compiled locally solved the problem

Great! Thanks.

So I have updated the lib #1309

For those that want to test the result, you could try the development version built there:
https://ci.appveyor.com/project/pmiossec/git-tfs-v2qcm/build/artifacts

Thanks , i have checked you build and it is working good!!

@ghost
Copy link

ghost commented Dec 23, 2019

@pmiossec thanks! That build worked for me too.

@keeganrowe
Copy link

@pmiossec will this make it into a new choco release? I got the latest ~3 months later than when this was fixed and the issue still exists.

@rudycas
Copy link

rudycas commented Apr 23, 2020

Latest Git-Tfs & latest libgit2sharp - compiled locally solved the problem

Great! Thanks.

So I have updated the lib #1309

For those that want to test the result, you could try the development version built there:
https://ci.appveyor.com/project/pmiossec/git-tfs-v2qcm/build/artifacts

Wow man... I was struggling (I'm not that good understanding this place)... with your download I was able to fix this error..

Because I had the 0.30 git-tfs version but the older LibGit2Sharp.dll version... THANKS A LOT!!

@siprbaum
Copy link
Member

This issue can be closed

@pmiossec
Copy link
Member

Fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests