[Mono-bugs] [Bug 79286][Wis] New - Still leaking WAPI process handles

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Sep 5 16:53:57 EDT 2006


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 brian at fluggo.com.

http://bugzilla.ximian.com/show_bug.cgi?id=79286

--- shadow/79286	2006-09-05 16:53:57.000000000 -0400
+++ shadow/79286.tmp.32078	2006-09-05 16:53:57.000000000 -0400
@@ -0,0 +1,91 @@
+Bug#: 79286
+Product: Mono: Runtime
+Version: 1.1
+OS: SUSE 9.2
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: brian at fluggo.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Still leaking WAPI process handles
+
+Description of Problem:
+Every now and then when executing an external process, a process handle is
+leaked in the WAPI table. (I don't know the details; just the symptoms.) 
+
+Steps to reproduce the problem:
+
+1. Compile and run the following program (the external program executed is
+not important):
+using System;
+using System.Diagnostics;
+
+namespace Test {
+    class Test {
+        static void Main() {
+            for( ;; ) {
+                try {
+                    ProcessStartInfo info = new ProcessStartInfo(
+"/sbin/ifconfig" );
+                    info.UseShellExecute = false;
+                    info.RedirectStandardOutput = true;
+                    info.RedirectStandardError = true;
+
+                    Process process = Process.Start( info );
+
+                    Console.WriteLine( process.StandardOutput.ReadLine() );
+                    Console.WriteLine( process.StandardError.ReadToEnd() );
+
+                    process.WaitForExit();
+                    process.Dispose();
+                }
+                catch( Exception ex ) {
+                    Console.WriteLine( ex );
+                }
+            }
+        }
+    }
+}
+
+2. From another command prompt, run "mono --wapi=hps" occasionally.
+
+Actual Results:
+Stray entries begin to appear while the program is running, like these:
+-----------
+ 29 (  1) [Process]    4 Sg ([           /sbin/ifconfig] pid:   683 exit: 0)
+ 6d (  1) [Process]    4 Sg ([           /sbin/ifconfig] pid:  5601 exit: 0)
+ 6f (  1) [Process]    4 Sg ([           /sbin/ifconfig] pid: 13687 exit: 0)
+ 76 (  1) [Process]    4 Sg ([           /sbin/ifconfig] pid: 29340 exit: 0)
+12c (  1) [Process]    4 Sg ([           /sbin/ifconfig] pid: 24527 exit: 0)
+-----------
+
+These entries appear randomly throughout the handle space.
+
+
+Expected Results:
+Since this program is single-threaded and properly disposes of the Process
+object, at most one external process handle should appear in the WAPI table
+at any given time.
+
+How often does this happen? 
+Every time the program runs long enough. On my machine, handles are leaked
+at intervals of less than one minute.
+
+Additional Information:
+This appears in SVN HEAD (r64487).
+
+It doesn't seem to matter whether the program is multi-threaded or whether
+Dispose() is called on the Process object. In these scenarios, more handles
+will appear in the WAPI table at the same time, but most of these will
+disappear appropriately between executions of "mono --wapi=hps".
+
+It also doesn't appear to matter whether one process is run right after
+another. I think this could happen for any external process. The above
+program just makes the occurence happen more quickly.


More information about the mono-bugs mailing list