Skip to content

MonoDevelop.VersionControl.Git crashes with a SIGSEGV #52

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

Closed
muhammadsammy opened this issue Jan 22, 2021 · 13 comments · Fixed by #55, #57 or #58
Closed

MonoDevelop.VersionControl.Git crashes with a SIGSEGV #52

muhammadsammy opened this issue Jan 22, 2021 · 13 comments · Fixed by #55, #57 or #58
Labels
bug Something isn't working

Comments

@muhammadsammy
Copy link

muhammadsammy commented Jan 22, 2021

Thanks for making this IDE compile again!
I get an error message The type initializer for 'LibGit2Sharp.Core.NativeMethods' threw an exception whever I open any file of in a solution with the IDE.
I see that #30 got closed, so is it related to this error or the editor is not ready yet?

Environment data

Built from the main branch.

dotnet --info output:

.NET SDK (reflecting any global.json):
 Version:   5.0.102
 Commit:    71365b4d42

Runtime Environment:
 OS Name:     debian
 OS Version:  
 OS Platform: Linux
 RID:         debian-x64
 Base Path:   /usr/share/dotnet/sdk/5.0.102/

Host (useful for support):
  Version: 5.0.2
  Commit:  cb5f173b96

.NET SDKs installed:
  3.1.404 [/usr/share/dotnet/sdk]
  5.0.102 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 3.1.10 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 5.0.2 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.10 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
  Microsoft.NETCore.App 5.0.2 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
  https://aka.ms/dotnet-download
@lytico
Copy link
Member

lytico commented Jan 22, 2021

thanks for trying!
what debian you are using? I want to try on your used os version.
on mint, it works.

you can try to disable the git-addin with Tools->Extensions->Versioncontrol->GitSupport
and see if the editor works then.

Another hint would be:

rm -R home/<yourusername>/.nuget/packages/libgit2sharp
rm -R home/<yourusername>/.nuget/packages/libgit2sharp.nativebinaries

and compile again.

BUT
you have NET SDK 5 installed, so you probably run into this issue: #40

@muhammadsammy
Copy link
Author

what debian you are using? I want to try on your used os version.
on mint, it works.

I'm using Debian sid

you can try to disable the git-addin with Tools->Extensions->Versioncontrol->GitSupport
and see if the editor works then.

That fixed the issue and the editor is now working. Thanks!

Another hint would be:

rm -R home/<yourusername>/.nuget/packages/libgit2sharp
rm -R home/<yourusername>/.nuget/packages/libgit2sharp.nativebinaries

and compile again.

I tried this multiple times, before and after removing .NET5 and it still does not fix the issue until I disable Git Support extension.
Since it's working on mint and ubuntu, It may be a problem specific to debian sid.

BUT
you have NET SDK 5 installed, so you probably run into this issue: #40

Yes, I ran into the same issue and it got resolved after removing .NET5. Thank you!

@lytico lytico changed the title Is the editor working? MonoDevelop.VersionControl.Git not working on debian sid Jan 22, 2021
@lytico lytico added the bug Something isn't working label Jan 22, 2021
@Molytho
Copy link

Molytho commented Jan 23, 2021

Since it's working on mint and ubuntu, It may be a problem specific to debian sid.

I complied it on debian buster and it isn't working either, so it is some sort of debian specific bug.

dotnet --info output:

.NET Core SDK (gemäß "global.json"):
 Version:   3.1.405
 Commit:    3fae16e62e

Laufzeitumgebung:
 OS Name:     debian
 OS Version:  10
 OS Platform: Linux
 RID:         debian.10-x64
 Base Path:   /usr/share/dotnet/sdk/3.1.405/

Host (useful for support):
  Version: 3.1.11
  Commit:  f5eceb8105

.NET Core SDKs installed:
  3.1.405 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

mono --version output:

Mono JIT compiler version 6.12.0.107 (tarball Thu Dec 10 05:28:17 UTC 2020)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
        TLS:           __thread
        SIGSEGV:       altstack
        Notifications: epoll
        Architecture:  amd64
        Disabled:      none
        Misc:          softdebug 
        Interpreter:   yes
        LLVM:          yes(610)
        Suspend:       hybrid
        GC:            sgen (concurrent by default)

@lytico
Copy link
Member

lytico commented Jan 24, 2021

See: dotdevelop/libgit2sharp#2
I'try to solve it there and create a package working on debian

@lytico lytico linked a pull request Jan 26, 2021 that will close this issue
@lytico lytico changed the title MonoDevelop.VersionControl.Git not working on debian sid MonoDevelop.VersionControl.Git not working on debian sid/buster Jan 26, 2021
@lytico
Copy link
Member

lytico commented Jan 27, 2021

@Molytho @muhammadsammy this branch worked for me on a fresh debian 10 install:

https://github.com/dotdevelop/dotdevelop/tree/dd/issues/52

can you confirm?

@muhammadsammy
Copy link
Author

Yes, can confirm it working on debian sid. thanks

@Molytho
Copy link

Molytho commented Jan 28, 2021

Sorry, can't confirm it. Now it crashes with a SIGSEGV. I will look into it when i have more time.

@lytico lytico reopened this Jan 28, 2021
@Molytho
Copy link

Molytho commented Feb 1, 2021

It's not an issue with libgit2sharp.nativebinaries. The arguments being passed to git_status_list_new (the first native libgit2 method in backtrace) are invalid, so this might be an issue in libgit2sharp.

@Molytho
Copy link

Molytho commented Feb 1, 2021

The issue lies somewhere in the marshalling. It is caused by the native call here.
While marshalling the coreOptions argument (GitStatusOptions: libgit2sharp -> git_status_options: libgit2) the baseline field which is not available in GitStatusOptions gets a valid pointer value. This makes libgit2 believe that the git_tree* is valid leading to a read of an invalid pointer value and finally to an invalid memory access.

@lytico
Copy link
Member

lytico commented Feb 2, 2021

the libgit2sharp - nuget used comes from this tree: https://github.com/dotdevelop/libgit2sharp/tree/dd/issues/2
the issue is dotdevelop/libgit2sharp#2

@hwthomas
Copy link
Collaborator

hwthomas commented Feb 6, 2021

This is just to confirm that this issue is not confined to debian - the same occurs on ubuntu, fedora and Arch.

Using the current main branch (@ecbe8d3), dotdevelop crashes consistently with a SIGSEGV.

Eg - open the (fairly complex) Solution https://github.com/dotdevelop/xwt

The solution can be loaded, and all packages restored successfully, but if the Solution pad is opened the crash occurs. Disabling the Version Control Git support extension from the Tools menu allows the Solution pad to be opened and the Xwt TestApps project to be edited and run without problems.

However, simple projects such as a Gtk# "Hello World" test (Framework 4.7.2) work OK even with the VC extension enabled (and the project is a git repo).

$ dotnet --info details (abbreviated) are:-

.NET Core SDK (reflecting any global.json):
  Version:   3.1.403
Host (useful for support):
  Version: 3.1.9
.NET Core runtimes installed:
  Microsoft.NETCore.App 2.2.8  
  Microsoft.NETCore.App 3.1.9  

I was about to raise a new Issue, but then noticed this same problem, together with your further investigations, tucked away as if it was only a debian sid/buster issue. Perhaps it's worth renaming it?

@lytico lytico changed the title MonoDevelop.VersionControl.Git not working on debian sid/buster MonoDevelop.VersionControl.Git crashes with a SIGSEGV Feb 8, 2021
@hwthomas
Copy link
Collaborator

I've had the following (different) results with recent versions of dotdevelop

In all cases the repository to be checked out is https://github.com/dotdevelop/xwt

dotdevelop_oe_8.4.3.12 Fails to check out github repo, with error invalid Version 0 on git_proxy_options

dotdevelop_oe_8.6 Checks out github repo successfully with all of the available protocols.

This then Loads the repo and all packages are restored OK, but crashes with a SIGSEGV when the Solution pad is opened.

However, dotdevelop_oe_8.4.3.12 can open this repo/solution without crashing, and also build and run it OK.

dotdevelop_main commit ecbe8d3cc1a (latest). Checks out repo OK using git:// protocol, but fails with error there is no TLS stream available using http:// or https:// protocols. Like dotdevelop_oe_8.6, crashes with SIGSEGV if Solution pad is clicked.

I've no facilities for debugging any of these versions further (dotdevelop won't yet build itself!) but perhaps the differences between these versions might suggest something?

@lytico
Copy link
Member

lytico commented Feb 11, 2021

Checks out repo OK using git:// protocol, but fails with error there is no TLS stream available using http:// or https:// protocols.

new issue here: dotdevelop/libgit2sharp#3

in the testrun, the error shows up, see: https://github.com/dotdevelop/libgit2sharp/runs/1770928010?check_suite_focus=true

@lytico lytico linked a pull request Mar 9, 2021 that will close this issue
@lytico lytico closed this as completed Mar 9, 2021
@lytico lytico linked a pull request Mar 12, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
4 participants