[Mono-bugs] [Bug 71274][Nor] Changed - finalizer-... tests randomly crash on x86 (Environment.Exit race)

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri Jul 1 15:48: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 bmaurer at users.sf.net.

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

--- shadow/71274	2005-07-01 14:54:47.000000000 -0400
+++ shadow/71274.tmp.21827	2005-07-01 15:48:10.000000000 -0400
@@ -437,6 +437,45 @@
 [Switching to thread 246 (Thread 1086213040 (LWP 13350))]#0 
 0x40012a9a in strcmp () from /lib/ld-linux.so.2
 (gdb) p mono_domain_get ()
 $1 = (MonoDomain *) 0x21f00
 
 So somehow, we are still alive in a domain that is being freed.
+
+------- Additional Comments From bmaurer at users.sf.net  2005-07-01 15:48 -------
+Here is a test case that lets me reproduce the issue every time:
+
+using System;
+using System.Collections;
+using System.Reflection;
+using System.Threading;
+
+class X {
+	static ArrayList ar = new ArrayList ();
+
+	static void Main ()
+	{
+		for (int i = 0; i < 10; i ++)
+			ar.Add (new X ());
+		Environment.Exit (1);
+		
+	}
+
+	static void LaLa ()
+	{
+		while (true) {
+			typeof (X).GetFields ();
+		}
+		
+	}
+	
+	~ X ()
+	{
+		new Thread (LaLa).Start ();
+	}
+	
+}
+
+When Environment.Exit is called, it first suspends all threads. Then
+it runs the finalizer. However, when the finalizer creates another
+therad, Exit does not know about that. So, when all the finalizers are
+run, it goes on its merry way and destroys the domain.


More information about the mono-bugs mailing list