[Mono-dev] Fixing all promiscuous use of mono_raise_exception
Rodrigo Kumpera
kumpera at gmail.com
Thu Aug 13 19:20:25 EDT 2009
The runtime function mono_raise_exception is very problematic and can't be
used
as promiscuous as it currently is.
The issue is that it will unwind the current block of unmanaged code
regardless of
it's state, which can be holding locks or floating memory (that needs to be
freed).
To avoid such problems I'm going to remove all uses of mono_raise_exception
from functions
that are not an icall, a top level trampoline target or has explicit
parameter telling to raise it[1].
Here is the list of functions that do causes problems for the runtime. The
functions or their callers
must be reworked to avoid memory leaks or deadlocks (all of those functions
are called with the loader lock held):
mono_make_shadow_copy
mono_runtime_class_init
mono_class_vtable
mono_string_to_utf8
The most problematic here is mono_string_to_utf8 that has over a 100 calls
spread all over the runtime.
I think we should deprecated and replaced with a version that doesn't raise
and just return null.
Callers of all object allocation functions must be audited as well because
those can throw too.
Rodrigo
[1]Those are deemed problematic as well and all callers must respect the
same rules
that applies to mono_raise_exception.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20090813/2e9ced54/attachment-0001.html
More information about the Mono-devel-list
mailing list