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

Memory corruption in underlying libgit2 native DLL #87

Closed
ricksladkey opened this issue Jan 7, 2016 · 12 comments
Closed

Memory corruption in underlying libgit2 native DLL #87

ricksladkey opened this issue Jan 7, 2016 · 12 comments
Labels

Comments

@ricksladkey
Copy link
Contributor

I've been getting crashes in Visual Studio 2015 and ignoring them. Finally, I debugged into one and found this call stack:

ntdll.dll!_RtlReportCriticalFailure@8() Unknown
ntdll.dll!_RtlpReportHeapFailure@4() Unknown
ntdll.dll!_RtlpLogHeapFailure@24() Unknown
ntdll.dll!_RtlFreeHeap@12() Unknown
kernel32.dll!_HeapFree@12() Unknown
git2-90befde.dll!24ead8ed() Unknown

So the git2 DLL is corrupting the heap.

This might be a good reason to upgrade to the latest libgit2 unmanaged DLL:

https://github.com/libgit2/libgit2/releases

The version of libgit2 distributed with the latest version of GitDiffMargin in the gallery appears to be:

File Version: 0.20.0.0

@laurentkempe
Copy link
Owner

@ricksladkey Thanks I will see to update it in the next release!

@laurentkempe
Copy link
Owner

@ricksladkey This should be fixed with #89 coming in the next release

@laurentkempe laurentkempe mentioned this issue Mar 19, 2016
2 tasks
@dezdechado
Copy link

Nope, the bug is still there :(. I had to rewrite the plugin with using of git.exe instead of libgit2. Have you considered such replacement? At least as an option? It would solve not only that bug, by the way. E.g. worktrees, as any futher git's features, would work out of the box. To be honest, I don't see any reason to use libgit2 at all. Git's binary is "must have" anyway IMHO.

@ricksladkey
Copy link
Contributor Author

For my part, I got one crash with the new version so far, which restarted Visual Studio before I could get a stack trace. However, it did have the same symptom, which was that running a git command from a command prompt (like git push, git commit --amend) was what triggered Visual Studio to crash. So my preliminary assessment is that the crash is still present with the new version. Will keep testing.

@laurentkempe
Copy link
Owner

git.exe instead of libgit2. Have you considered such replacement?

@dezdechado I was using git.exe at the beginning of the project! The problem is that I couldn't ensure that git.exe was on the machine of the user

@laurentkempe
Copy link
Owner

I got one crash with the new version so far

@ricksladkey Didn't get any crash and working with it since last Sunday. Did all sort of things in cmd line; git-imerge, rebase... from sourcetree also and never got a crash till now.

Will keep testing

Would be great if you would find a way to reproduce the problem!

@dezdechado
Copy link

@laurentkempe

The problem is that I couldn't ensure that git.exe was on the machine of the

I understand that. The plugin could provide both solutions and let user decide wich one to use (As TortoiseGit does. It has switch "Use libgit2: true/false").
As for the bug, it's hard to find a way to reproduce it reliably (I think). It crashs pretty randomly. Hints: I use Microsoft Git Provider and the repository I'm working on is quite big (>3Gb). I can try to take a look, but it's such a waste of time to find bugs in libgit2 IMHO

@laurentkempe
Copy link
Owner

@dezdechado I also use Microsoft Git Provider but ok the repository I deal with are smaller!

I will think about the idea of TortoiseGit to let the user choose!

@dezdechado
Copy link

Great! Thank you in advance!
By the way, I could try to do it if you are interested in.

@laurentkempe
Copy link
Owner

@dezdechado sure submit a PR

@ricksladkey
Copy link
Contributor Author

Another crash, this time I got a stack trace.

ntdll.dll!_RtlReportCriticalFailure@8�() Unknown
ntdll.dll!_RtlpReportHeapFailure@4�() Unknown
ntdll.dll!_RtlpLogHeapFailure@24�() Unknown
ntdll.dll!_RtlFreeHeap@12�() Unknown
kernel32.dll!_HeapFree@12�() Unknown
git2-785d8c4.dll!23fb343d() Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for git2-785d8c4.dll]

git2-785d8c4.dll    C:\Users\jrs\AppData\Local\Microsoft\VisualStudio\14.0\Extensions\xrwk5bli.tj2\git2-785d8c4.dll N/A N/A Cannot find or open the PDB file.       279 0.24.0.0    3/4/2016 10:54 AM   23F20000-23FEA000*  [23200] devenv.exe      

Same folder as GitDiffMargin.dll, 3.1.1.0

Command that triggered it:

git checkout file-name

@laurentkempe
Copy link
Owner

@dezdechado I gave some more thought about using git.exe again after reading that Visual Studio 2017 while use git.exe in place of LibGit2Sharp. The problem I am facing is that getting live diff will not work with it!

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

No branches or pull requests

3 participants