[Mono-bugs] [Bug 77847][Min] New - "Too many threads" error when starting and stopping a timer repeatedly

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Mar 18 19:57:04 EST 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 paul.hudson at gmail.com.


--- shadow/77847	2006-03-18 19:57:03.000000000 -0500
+++ shadow/77847.tmp.4944	2006-03-18 19:57:04.000000000 -0500
@@ -0,0 +1,45 @@
+Bug#: 77847
+Product: Mono: Runtime
+Version: 1.1
+OS Details: 
+Status: NEW   
+Priority: Minor
+Component: GC
+AssignedTo: lupus at ximian.com                            
+ReportedBy: paul.hudson at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: "Too many threads" error when starting and stopping a timer repeatedly
+I came across this error in a complex program that uses many different
+timers. On Linux it ran just fine, but on Windows it bailed out with the GC
+message "Too many threads". The problem seems to be that each time I was
+calling Stop() and Start() on a timer, a new thread was created and the old
+one was left lingering just long enough to cause a problem. This wasn't a
+problem when running the binary on the MS .NET runtime instead of Mono.
+Steps to reproduce the problem:
+1. Compile the attached test case
+2. Run it on Windows with Mono
+3. Get error message
+Actual Results:
+"Fatal error in GC: too many threads".
+Expected Results:
+Program should execute just fine.
+How often does this happen? 
+Every time.
+Additional Information:
+I guess this might come down to a race condition somewhere. FWIW, I've
+tested this on a 1.6GHz Athlon and a 2.2GHz Athlon 64. Note that my test
+case is very simplistic, starting and stopping a single timer 200 times. In
+my actual code I have more than a hundred timers, which was how I came
+across the problem.

More information about the mono-bugs mailing list