Bug 1682 - Handles leak with Process.Start if Process.WaitForExit is not called
Summary: Handles leak with Process.Start if Process.WaitForExit is not called
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: io-layer ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
: 6437 ()
Depends on:
Blocks:
 
Reported: 2011-10-25 14:39 UTC by Randy Chapman
Modified: 2013-01-11 16:23 UTC (History)
3 users (show)

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


Attachments
Repro case (809 bytes, text/plain)
2011-10-25 14:39 UTC, Randy Chapman
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 Randy Chapman 2011-10-25 14:39:36 UTC
Created attachment 764 [details]
Repro case

According to MSDN documentation, and running on win7 with MS CLR, it is valid to start a process with p = Process.Start() and then call p.Close(), without ever calling p.WaitForExit().  You can, in fact, save the process id from the original process object, and create a new one with Process.GetFromProcessId, and call WaitForExit() on that new object, and there will be no leak on the MS CLR.

However, if you do this with the Mono CLR, you can only start 255 processes before failure:

    Starting process #255
    CreateProcess: error creating process handle

I checked this on Linux Mono 2.10.5 and OS/X 2.10.6

Simple repro code is attached.
Comment 1 Zoltan Varga 2011-11-04 13:16:10 UTC
Fixed in HEAD/mono-2-10 branch.
Comment 2 Rodrigo Kumpera 2013-01-11 16:23:12 UTC
*** Bug 6437 has been marked as a duplicate of this bug. ***