[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
Sat Jul 2 18:51:53 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.


--- shadow/71274	2005-07-01 16:21:57.000000000 -0400
+++ shadow/71274.tmp.4776	2005-07-02 18:51:53.000000000 -0400
@@ -481,6 +481,38 @@
 run, it goes on its merry way and destroys the domain.
 ------- Additional Comments From sebastien at ximian.com  2005-07-01 16:21 -------
 Maybe "some" code should check Environment.HasShutdownStarted before
 taking action. The property doesn't seem to be used anywhere inside
 corlib. m2c
+------- Additional Comments From bmaurer at users.sf.net  2005-07-02 18:51 -------
+Yes, people should probably use that. However, the test case I posted
+probably needs to get stopped in the runtime. cbrumme's weblog states:
+    *  The unload thread freezes the runtime.  This is similar to the
+freeze that happens during (portions of) a garbage collection.  It
+results in a barrier that prevents all managed execution.
+    * While the barrier is in place for all managed execution, the
+unload thread erects a finer-grained barrier which prevents entry into
+the doomed AppDomain.  Any attempt to call in will be rejected with a
+DomainUnloaded exception.  The unload thread also examines the stacks
+of all managed threads to decide which ones must be unwound.  Any
+thread with stack in the doomed AppDomain – even if it is currently
+executing in a different AppDomain – must be unwound.  Some threads
+might have multiple disjoint regions of stack in the doomed AppDomain.
+ When this is the case, we determine the base-most frame that must be
+unwound before this thread is no longer implicated in the doomed
+    * The unload thread unfreezes the runtime.  Of course, the
+finer-grained barrier remains in place to prevent any new threads from
+entering the doomed AppDomain.
+Unloading an appdomain and exiting the process are probably similar.
+We need to make sure that once we have started either process that no
+new threads can be created.

More information about the mono-bugs mailing list