Bug 10465 - Mono crashes when running too many processes
Summary: Mono crashes when running too many processes
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-02-20 08:58 UTC by croisharp
Modified: 2014-12-01 04:38 UTC (History)
3 users (show)

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

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 croisharp 2013-02-20 08:58:26 UTC
I created a test program and it also doesn't work. 
It fails with:

ApplicationName='ping', CommandLine='localhost', CurrentDirectory=''
  at System.Diagnostics.Process.Start_noshell (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown>:0 
  at System.Diagnostics.Process.Start_common (System.Diagnostics.ProcessStartInfo startInfo, System.Diagnostics.Process process) [0x00000] in <filename unknown>:0 
  at System.Diagnostics.Process.Start (System.Diagnostics.ProcessStartInfo startInfo) [0x00000] in <filename unknown>:0 
  at test1.MainClass.Start (System.String name, System.String args) [0x00000] in <filename unknown>:0

and 

CreateProcess: error creating process handle 


and starts only 254 processes on my pc.



Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-5ubuntu1)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  amd64
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            Included Boehm (with typed GC and Parallel Mark)


I've also big ulimit -u/-v values and this didn't solved the problem.




So this is the test code:

		static TextWriter tw = new StreamWriter("error.txt");
		private static int _started;
		public static void Main (string[] args)
		{

			for (int i=0; i<1000; i++) {
				Start ("ping", "localhost");

			}
			Console.WriteLine("Memory: " + (GC.GetTotalMemory(true) / 1024) + " KB");
			Console.WriteLine(_started);
			tw.Flush();
			Console.ReadLine();
		}

		public static Process Start (string name, string args)
		{
			try {
				var proc = new ProcessStartInfo {
        				FileName = name,
        				Arguments = args,
        				RedirectStandardOutput = true,
        				CreateNoWindow = false,
						RedirectStandardError = false,
						UseShellExecute = false,
						RedirectStandardInput = false,
				};
				Process.Start (proc);
				_started++;
			} catch (Exception ex) {
				tw.WriteLine (ex.InnerException+Environment.NewLine+ex.Message + Environment.NewLine + ex.StackTrace, false);
				tw.Flush();
			}
			return null;
		}
Comment 1 Zoltan Varga 2013-02-23 17:35:14 UTC
You can probably work around this problem by calling proc.Close ().
Comment 2 Zoltan Varga 2014-12-01 04:38:28 UTC
This was fixed some time ago.