Bug 38544 - Process.Start crashes on SMP ARM systems (dual-core iMX6)
Summary: Process.Start crashes on SMP ARM systems (dual-core iMX6)
Status: RESOLVED NORESPONSE
Alias: None
Product: Runtime
Classification: Mono
Component: GC (show other bugs)
Version: 4.0.0
Hardware: Other Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-02-08 16:02 UTC by mail
Modified: 2017-10-11 17:41 UTC (History)
4 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description mail 2016-02-08 16:02:28 UTC
Simplest possible test case crashes after running the application between 1 and 500 times in a for loop:
s=0; while [[ "$s" == "0" ]]; do mono crash.exe; s=$?; done

void crash()
{
    Process pProcess = new Process();
    pProcess.StartInfo = new ProcessStartInfo("/bin/true", "");
    pProcess.Start();
    pProcess.WaitForExit();
    pProcess.Close();
    pProcess.Dispose();
    pProcess = null;
}


Build & run with gmcs. Run on Linux-3.16 / Mono-4.2.1.124 and it segfaults in random locations. Sometimes I get a stack trace, sometimes I don't. Some of them are included at the end of this ticket.

If I disable a cpu core (echo 0 > /sys/devices/system/cpu/cpu1/online) so I only have one active core, the tests have been running for 10 minutes now which should translate into a few thousand runs. Therefore the problem seems to be related to multi-core systems.  I'm also running the same Linux and Mono version on a single-core x86 system, where this does not occur.

Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
  at System.Diagnostics.Process.BeginOutputReadLine () <0x76c9b7b0 + 0x001f4> in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:BeginOutputReadLine ()
  at Foo.ForkExec.Run (System.String sFileName, System.String sArguments, Boolean bPipeOutput, Int32 iTimeoutMs, IDictionary`2 pEnvironment) <0x76d42218 + 0x00943> in <filename unknown>:0 
  at Foo.Test.Main () <0x76d42010 + 0x0002f> in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
  at System.Diagnostics.Process.BeginOutputReadLine () <0x76c9b7b0 + 0x001f4> in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:BeginOutputReadLine ()
  at Foo.ForkExec.Run (System.String sFileName, System.String sArguments, Boolean bPipeOutput, Int32 iTimeoutMs, IDictionary`2 pEnvironment) <0x76d42218 + 0x00943> in <filename unknown>:0 
  at Foo.Test.Main () <0x76d42010 + 0x0002f> in <filename unknown>:0 
436 ---------------------
Exit code: 1
Runs: 436


Unhandled Exception:
System.NullReferenceException: Object reference not set to an instance of an object
  at System.Delegate.Combine (System.Delegate a, System.Delegate b) <0x76c83008 + 0x00030> in <filename unknown>:0 
  at System.Diagnostics.Process.add_OutputDataReceived (System.Diagnostics.DataReceivedEventHandler value) <0x76c82f08 + 0x0002f> in <filename unknown>:0 
  at Foo.ForkExec.Run (System.String sFileName, System.String sArguments, Boolean bPipeOutput, Int32 iTimeoutMs, IDictionary`2 pEnvironment) <0x76d2a218 + 0x0070b> in <filename unknown>:0 
  at Foo.Test.Main () <0x76d2a010 + 0x0002f> in <filename unknown>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.NullReferenceException: Object reference not set to an instance of an object
  at System.Delegate.Combine (System.Delegate a, System.Delegate b) <0x76c83008 + 0x00030> in <filename unknown>:0 
  at System.Diagnostics.Process.add_OutputDataReceived (System.Diagnostics.DataReceivedEventHandler value) <0x76c82f08 + 0x0002f> in <filename unknown>:0 
  at Foo.ForkExec.Run (System.String sFileName, System.String sArguments, Boolean bPipeOutput, Int32 iTimeoutMs, IDictionary`2 pEnvironment) <0x76d2a218 + 0x0070b> in <filename unknown>:0 
  at Foo.Test.Main () <0x76d2a010 + 0x0002f> in <filename unknown>:0 
116 ---------------------
Exit code: 1
Runs: 116

Unhandled Exception:
System.IO.IOException: Invalid handle to path "[Unknown]"
  at System.IO.FileStream.Init (Microsoft.Win32.SafeHandles.SafeFileHandle safeHandle, FileAccess access, Boolean ownsHandle, Int32 bufferSize, Boolean isAsync, Boolean isZeroSize) <0x76c15130 + 0x0014c> in <filename unknown>:0
  at System.IO.FileStream..ctor (IntPtr handle, FileAccess access, Boolean ownsHandle, Int32 bufferSize, Boolean isAsync, Boolean isZeroSize) <0x76c14fb8 + 0x000c3> in <filename unknown>:0
  at System.IO.FileStream..ctor (IntPtr handle, FileAccess access, Boolean ownsHandle) <0x73b6eb50 + 0x00047> in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (intptr,System.IO.FileAccess,bool)
  at System.Diagnostics.Process+ProcessAsyncReader..ctor (System.Diagnostics.Process process, IntPtr handle, Boolean err_out) <0x73b6e880 + 0x00027> in <filename unknown>:0
  at System.Diagnostics.Process.BeginOutputReadLine () <0x73b6e528 + 0x001c7> in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:BeginOutputReadLine ()
  at Foo.ForkExec.Run (System.String sFileName, System.String sArguments, Boolean bPipeOutput, Int32 iTimeoutMs, IDictionary`2 pEnvironment) <0x76ca3218 + 0x007d3> in <filename unknown>:0
  at Foo.Test.Main () <0x76ca3010 + 0x0002f> in <filename unknown>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.IO.IOException: Invalid handle to path "[Unknown]"
  at System.IO.FileStream.Init (Microsoft.Win32.SafeHandles.SafeFileHandle safeHandle, FileAccess access, Boolean ownsHandle, Int32 bufferSize, Boolean isAsync, Boolean isZeroSize) <0x76c15130 + 0x0014c> in <filename unknown>:0
  at System.IO.FileStream..ctor (IntPtr handle, FileAccess access, Boolean ownsHandle, Int32 bufferSize, Boolean isAsync, Boolean isZeroSize) <0x76c14fb8 + 0x000c3> in <filename unknown>:0
  at System.IO.FileStream..ctor (IntPtr handle, FileAccess access, Boolean ownsHandle) <0x73b6eb50 + 0x00047> in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (intptr,System.IO.FileAccess,bool)
  at System.Diagnostics.Process+ProcessAsyncReader..ctor (System.Diagnostics.Process process, IntPtr handle, Boolean err_out) <0x73b6e880 + 0x00027> in <filename unknown>:0
  at System.Diagnostics.Process.BeginOutputReadLine () <0x73b6e528 + 0x001c7> in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process:BeginOutputReadLine ()
  at Foo.ForkExec.Run (System.String sFileName, System.String sArguments, Boolean bPipeOutput, Int32 iTimeoutMs, IDictionary`2 pEnvironment) <0x76ca3218 + 0x007d3> in <filename unknown>:0
  at Foo.Test.Main () <0x76ca3010 + 0x0002f> in <filename unknown>:0
459 ---------------------
Exit code: 1
Runs: 459


* Assertion at remoting.c:344, condition `((MonoObject *)this)->vtable->klass == mono_defaults.transparent_proxy_class' not met

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) object.__icall_wrapper_mono_remoting_wrapper (intptr,intptr) <0xffffffff>
  at (wrapper remoting-invoke) System.IO.StreamReader..ctor (System.IO.Stream,System.Text.Encoding,bool,int) <0xffffffff>
  at (wrapper remoting-invoke-with-check) System.IO.StreamReader..ctor (System.IO.Stream,System.Text.Encoding,bool,int) <0xffffffff>
  at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process) <0x010fb>
  at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo,System.Diagnostics.Process) <0x000e3>
  at System.Diagnostics.Process.Start () <0x0003f>
  at (wrapper remoting-invoke-with-check) System.Diagnostics.Process.Start () <0xffffffff>
  at Foo.ForkExec.Run (string,string,bool,int,System.Collections.Generic.IDictionary`2<string, string>) <0x0053f>
  at Foo.Test.Main () <0x0002f>
  at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) <0xffffffff>

Native stacktrace:


Debug info from gdb:


=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

Aborted
465 ---------------------
Exit code: 134
Runs: 465
Comment 1 mail 2016-02-09 04:17:59 UTC
Note: The first few levels (Foo.ForkExec.*) of the callstacks were run with the same code, within a wrapper, but the rest of the callstacks are the same. I.e., more or less random.


After disabling one of the system cores, the test application has been running for 12 hours / 300k iterations without crashing. From this I conclude there is a bug in Mono on multi-core ARM systems.
Comment 2 mail 2016-02-09 04:59:24 UTC
MONO_GC_PARAMS="major=marksweep" (instead of the -par version) and --gc=sgen made no difference when both cores are enabled.
Comment 3 mail 2016-02-26 17:12:35 UTC
So, this has been around for over 10 years now, and it's not only on ARM/Linux. 

http://lists.freebsd.org/pipermail/freebsd-threads/2005-February/002909.html
Comment 4 Vlad Brezae 2016-11-03 18:01:44 UTC
I was not able to repro this on two different ARM SMP boards. Are you still getting this with newer mono versions / different OS ? Would it be possible to provide access to such a device where this crash happens ?
Comment 5 Rodrigo Kumpera 2017-10-11 17:41:41 UTC
We have not received the requested information. If you are still experiencing this issue please provide all the requested information and reopen the bug report.

Thank you!

Note You need to log in before you can comment on or make changes to this bug.