Bug 25720

Summary: Runtime crashing when evaluating System.Diagnostics.Process.HasExited property
Product: [Mono] Runtime Reporter: Eirik Tsarpalis <eirik>
Component: GeneralAssignee: Bugzilla <bugzilla>
Status: RESOLVED FIXED    
Severity: normal CC: henrik, mono-bugs+mono, mono-bugs+runtime, prerana.polekar28, sevo, vargaz
Priority: ---    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Tags: Is this bug a regression?: ---
Last known good build:

Description Eirik Tsarpalis 2015-01-05 14:38:09 UTC
Running the following code (in F#) results in consistent crashing of the mono runtime:
```
let p = System.Diagnostics.Process.GetCurrentProcess()
p.HasExited
```
with the following error
```
* Assertion at processes.c:2595, condition `mp' not met

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Diagnostics.Process.ExitCode_internal (intptr) <0xffffffff>
  at System.Diagnostics.Process.get_ExitCode () <0x0002f>
```
Comment 1 Zoltan Varga 2015-01-06 13:02:11 UTC
What mono version is this ? Please try at least mono 3.12, many process crashes etc. were fixed in that version.
Comment 2 Eirik Tsarpalis 2015-01-07 06:37:24 UTC
It's mono 3.12 from the beta channel of OSX

Mono JIT compiler version 3.12.0 ((detached/a813491 Thu Dec 11 12:24:44 EST 2014)
Comment 3 Zoltan Varga 2015-01-07 07:06:17 UTC
I can reproduce this.
Comment 4 Zoltan Varga 2015-01-08 04:48:45 UTC
Fixed in mono master b1038846342d5b7bb030c58ec4c463de6d12f06e.
Comment 5 Prerana 2015-01-16 02:32:29 UTC
When this fix will be released? I am unable to pull it from mono masters. 
Xamarin Studio currently is :

Xamarin Studio
Version 5.7 (build 661)
Installation UUID: fccf861a-7e5e-44b3-bba1-fa9c8372a28f
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068
Comment 6 Prerana 2015-01-16 03:58:53 UTC
When this fix will be released? I am unable to pull it from mono masters. 
Xamarin Studio currently is :

Xamarin Studio
Version 5.7 (build 661)
Installation UUID: fccf861a-7e5e-44b3-bba1-fa9c8372a28f
Runtime:
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068
Comment 7 Zoltan Varga 2015-01-16 08:27:28 UTC
It will be in the next major mono release after 3.12. As a workaround, avoid calling HasExited on
the current process, i.e.
if (proc != Process.CurrentProcess)
    proc.HasExited ...
Comment 8 Vsevolod Kukol 2015-01-21 08:13:19 UTC
The recent official debian packages (http://origin-download.mono-project.com/repo/debian) seem to be affected, too. And there is no way back for Linux users (ok only the distribution packages, which are quite old on e.g.  Ubuntu).
Is there no way to merge the fix into the 3.12 branch for the official debian release?
Comment 9 henrik 2015-02-12 12:02:39 UTC
Duplicate to https://bugzilla.xamarin.com/show_bug.cgi?id=26514 ?

Fixed by b103884?
Comment 10 henrik 2015-02-12 13:26:36 UTC
The workaround doesn't work in this code https://github.com/fsprojects/Paket/commit/25c363a0d35ca7fd8e3ef48c34ccd74d0071f0da
Comment 11 Zoltan Varga 2015-02-12 14:26:38 UTC
Try proc.Id != Process.GetCurrentProcess ().Id. That seems to work in 3.12 too.