[Mono-bugs] [Bug 322163] runtime hangs after main() exit

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon May 19 18:50:35 EDT 2008


User vargaz at gmail.com added comment

--- Comment #13 from Zoltan Varga <vargaz at gmail.com>  2008-05-19 16:50:34 MST ---
Shutting down a managed runtime is not easy, see 
for a discussion of how the MS.NET runtime does it. Basically, we could just
call libc exit () and be done with it, but people expect finalizers to be
etc. Some people even expect us to clean up all memory used by the runtime.
Since cleaning up runtime memory structures while some threads are running
which use them is not wise, we need to (at least) suspend all managed threads. 
suspending threads is again not easy, since unix has no SuspendThread call like 
win32 does, if a thread is suspended while holding some lock, the whole stuff 
could deadlock. So this is not a simple problem at all, and I'm not suprised
there are bugs. Also, as I said, f-spot is not a simple program, so it might 
itself hang even when the runtime shutdown code works fine.

For a quick-and-dirty solution, you could try patching f-spot so instead of
calling Environment.Exit (), it would pinvoke the libc exit () function. That
would most likely work, except when some library like gtk installs an atexit ()
handler which does some strange thing and crashes/hangs...

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list