[Mono-dev] Shutdown and Threads
Mark Probst
mark.probst at gmail.com
Tue Dec 11 05:10:10 EST 2007
Hi Dick, Paolo and everybody else!
Regarding our shutdown issues (like bug #337383): I tried out a few
shutdown test cases with the Microsoft runtime and it doesn't seem
like they allow new threads to be started once shutdown is in
progress. One can instantiate a Thread in a finalizer and even call
Start() without causing an exception, but the thread will not run.
Instead it will get finalized, too. Timers don't run anymore, either.
Implementing a finalizer-chain (instantiating one more object in the
finalizer whose finalization causes yet another object to be
instantiated, etc) is possible, but at some point (maybe due to a
timeout, maybe due to how the GC shutdown is implemented) no new
objects can be created and an OutOfMemoryException is thrown.
So, what I propose to implement in Mono is this: Once shutdown is in
progress inhibit starting of new threads, normal as well as threadpool
ones. Just fail silently (or write a warning message). Then make
sure all threads are properly suspended. Then do finalization.
Is everybody ok with that?
Mark
More information about the Mono-devel-list
mailing list