[Mono-bugs] [Bug 75147][Wis] New - System.Diagnostics.Process class
leaves zombie processes
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Jun 3 17:36:10 EDT 2005
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by jlarimer at gmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=75147
--- shadow/75147 2005-06-03 17:36:10.000000000 -0400
+++ shadow/75147.tmp.28817 2005-06-03 17:36:10.000000000 -0400
@@ -0,0 +1,81 @@
+Bug#: 75147
+Product: Mono: Class Libraries
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: Fedora Core 2
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: System
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: jlarimer at gmail.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: System.Diagnostics.Process class leaves zombie processes
+
+> Description of Problem:
+
+The System.Diagnostics.Process class can leave zombie processes around in
+Linux that won't go away until Mono exits. If this happens enough, no more
+processes will be able to fork on the system, making the machine unusable.
+
+It doesn't happen when the WaitForExit() method is used to wait for a
+process to exit.
+
+> Steps to reproduce the problem:
+
+using System;
+using System.IO;
+using System.Diagnostics;
+
+class ProcessTest {
+ static void Main() {
+
+ while(true) {
+ ProcessStartInfo si = new
+ProcessStartInfo("/sbin/ifconfig", "eth0");
+
+ Process p = Process.Start(si);
+
+ //p.WaitForExit(-1);
+ System.Threading.Thread.Sleep(500);
+
+ p.Close();
+
+ System.Threading.Thread.Sleep(10 * 1000);
+ }
+ }
+}
+
+
+> Actual Results:
+
+If you run the above code for a while, then type "ps -aef | grep defunct"
+at another shell prompt, you'll see a list of zombied processes:
+
+jlarimer 19569 19566 0 16:05 pts/3 00:00:00 [ifconfig] <defunct>
+jlarimer 19570 19566 0 16:05 pts/3 00:00:00 [ifconfig] <defunct>
+jlarimer 19571 19566 0 16:06 pts/3 00:00:00 [ifconfig] <defunct>
+jlarimer 19572 19566 0 16:06 pts/3 00:00:00 [ifconfig] <defunct>
+jlarimer 19573 19566 0 16:06 pts/3 00:00:00 [ifconfig] <defunct>
+jlarimer 19574 19566 0 16:06 pts/3 00:00:00 [ifconfig] <defunct>
+jlarimer 19575 19566 0 16:06 pts/3 00:00:00 [ifconfig] <defunct>
+
+
+> Expected Results:
+
+I expect the processes to go away. If you uncomment the WaitForExit() line
+and comment out the Sleep() line after it, this doesn't happen.
+
+> How often does this happen?
+
+Every time.
+
+> Additional Information:
+
+I noticed this happening when redirecting standard output and calling
+ReadToEnd() on the stream. I fixed the problem in my code by using a
+WaitForExit() call.
More information about the mono-bugs
mailing list