[Mono-dev] mono_jit_init fails when called from a Qt QThread

Frank Fuchs fk.fuchs at googlemail.com
Tue Aug 10 16:00:20 EDT 2010


Hi,
I think I have a rather special problem here. I have a Qt C++ application with an embedded mono jit.
Everything works nicely so far. However, I recently tried to start the Jit from a Qthread 
(in order to have an unblocked GUI during the "C# script" execution, which can be several minutes).
Sadly I don't even get close to execution of the assembly, since the mono_jit_init_version call fails.
The stack trace provided by gdb is attached below. To me it looks like Qt does not play nice with pthreads as used by the GC.
(I found something similar using QThreads and openmp together.)
Any comments? Whose fault is it? I read something about the "new GC", would it cure this?

BTW: system is Mac OS X 10.6.4 with mono 2.7 build from trunk.

Thank you in advance! 
Frank


Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_INVALID_ADDRESS at address: 0x00000001187f0000
[Switching to process 17263]
0x000000010084a7db in GC_push_all_eager ()
(gdb) where
#0  0x000000010084a7db in GC_push_all_eager ()
#1  0x000000010084a850 in GC_push_all_stack ()
#2  0x0000000100853493 in GC_push_all_stacks ()
#3  0x000000010084e091 in GC_default_push_other_roots ()
#4  0x000000010084bdae in GC_push_roots ()
#5  0x0000000100848c86 in GC_mark_some ()
#6  0x0000000100840ee4 in GC_stopped_mark ()
#7  0x0000000100840a54 in GC_try_to_collect_inner ()
#8  0x000000010084c85c in GC_init_inner ()
#9  0x0000000100847104 in GC_generic_malloc_inner ()
#10 0x0000000100852f54 in GC_pthread_create ()
#11 0x000000010073ceed in macosx_register_exception_handler [inlined] () at /Users/fuchs/Work/Codes/Libraries/Install-mono_160737/mono/mini/mini-darwin.c:170
#12 0x000000010073ceed in mono_runtime_install_handlers () at mini-darwin.c:193
#13 0x00000001006641be in mini_init (filename=0x100257bc9 "MooseQT Root Domain", runtime_version=0x100257bbe "v2.0.50727") at mini.c:5759
#14 0x00000001000eacf9 in SingletonJit (this=0x1028adcf0) at ScriptEngine/ScriptEngineMono.cpp:44
#15 0x00000001000eac35 in SingletonJit::GetInstance () at ScriptEngine/ScriptEngineMono.cpp:35
#16 0x00000001000eabfd in SingletonJit::GetMonoDomain () at ScriptEngine/ScriptEngineMono.cpp:27
#17 0x00000001000eb716 in ScriptEngineMono::CompileAndRun (this=0x7fff5fbfdf88, rSourcefiles={{p = {static shared_null = {ref = {_q_value = 3691}, alloc = 0, begin = 0, end = 0, sharable = 1, array = {0x0}}, d = 0x118809820}, d = 0x118809820}}) at ScriptEngine/ScriptEngineMono.cpp:157
#18 0x00000001000f5d3f in ScriptEngineMoose::run (this=0x7fff5fbfdf60) at ScriptEngine/ScriptEngineMoose.cpp:1148
#19 0x0000000101d1adaf in QThreadPrivate::start ()
#20 0x00007fff8704d456 in _pthread_start ()
#21 0x00007fff8704d309 in thread_start ()



More information about the Mono-devel-list mailing list