[Mono-bugs] [Bug 78241][Maj] Changed - CreateThread failure/out of wapi handles slots

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu May 4 12:36:55 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 robertj at gmx.net.

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

--- shadow/78241	2006-05-04 11:14:09.000000000 -0400
+++ shadow/78241.tmp.21482	2006-05-04 12:36:55.000000000 -0400
@@ -423,6 +423,45 @@
 > calling BeginInvoke have an enormous high handle ref
 > count (400-500). These are also the handles that leak.
 
 Ah, that's because the threads get reused from the
 thread pool.
 
+
+------- Additional Comments From robertj at gmx.net  2006-05-04 12:36 -------
+Okay, I'm pretty sure that the ref count of the handles of 
+the threapool threads never reaches zero.
+
+I see how they are created and disposed (that's always pairwise,
+no bug so far), but if I monitor CloseHandle the ref count is
+always >>> 0.
+
+Tested with 1 CPU and 25 thread pool threads.
+
+Here is the test case:
+
+using System;
+using System.Runtime.Remoting.Messaging;
+using System.Threading;
+
+class T
+{
+        delegate void MethodDelegate ();
+
+        static void Main ()
+        {
+                MethodDelegate d = new MethodDelegate (Method);
+                for (int i = 0; ; i++) {
+                        d.BeginInvoke (null, null);
+                        if (i % 10000 == 0) {
+                                // force the pool to recycle some threads
+                                Thread.Sleep (1000);
+                        }
+                }
+        }
+
+        static void Method ()
+        {
+        }
+
+}
+


More information about the mono-bugs mailing list