Bug 56194 - SIGSEGV on System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray()
Summary: SIGSEGV on System.Runtime.CompilerServices.RuntimeHelpers.InitializeArray()
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: JIT (show other bugs)
Version: master
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Rodrigo Kumpera
URL:
Depends on:
Blocks:
 
Reported: 2017-05-10 20:16 UTC by Evgeni
Modified: 2017-11-06 23:02 UTC (History)
5 users (show)

Tags: bugpool-archive
Is this bug a regression?: ---
Last known good build:


Attachments
Memory dump of the error and VS sample project (6.34 KB, application/x-zip-compressed)
2017-05-10 20:16 UTC, Evgeni
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Evgeni 2017-05-10 20:16:51 UTC
Created attachment 22072 [details]
Memory dump of the error and VS sample project

I'm trying to run the following code on Linux Bash Shell on Windows 10 x64, but it also fails the same way on Ubuntu. 

class Program
{
        int[] _testArray = { 3, 49, 40, 58, 32 };

        static void Main(string[] args)
        {
            var arr = new int[5];
            var type = Assembly.GetExecutingAssembly().GetTypes().Where(x => x.Name.Contains("<PrivateImplementationDetails>")).Single();
            var fieldInfo = type.GetFields(BindingFlags.NonPublic | BindingFlags.Static).Single();
            RuntimeHelpers.InitializeArray(arr, fieldInfo.FieldHandle);
        }
}

The code above runs perfectly on Windows .NET and Mono versions for Windows. 

If I make _testArray static the problem goes away.

Mono JIT compiler version 4.8.1 (Stable 4.8.1.0/22a39d7 Wed Apr 12 12:00:40 UTC 2017)

Please find attached memory dump and a sample project for Visual Studio.

Any help is much appreciated!
Comment 1 Bernhard Urban 2017-09-06 15:33:22 UTC
can reproduce on 5.4.0, MacOS (amd64):

> % mono --version
> Mono JIT compiler version 5.4.0.147 (2017-06/28a417c Fri Aug  4 13:27:50 EDT 2017)
> Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
> 	TLS:           normal
> 	SIGSEGV:       altstack
> 	Notification:  kqueue
> 	Architecture:  amd64
> 	Disabled:      none
> 	Misc:          softdebug
> 	LLVM:          yes(3.6.0svn-mono-master/8b1520c)
> 	GC:            sgen (concurrent by default)
Comment 2 Ludovic Henry 2017-10-06 20:36:54 UTC
I can reproduce with Mono 5.8.0.2 (2017-10/a3943e28cf8)
Comment 3 Rodrigo Kumpera 2017-10-09 21:21:24 UTC
PR against master: https://github.com/mono/mono/pull/5746
Comment 4 Rodrigo Kumpera 2017-10-11 17:01:36 UTC
Fixed in master