[Mono-list] embeded mono segfaults without calling managed code

Robert Jordan robertj at gmx.net
Tue Aug 6 08:47:20 UTC 2013


mono_domain_get() relies on the current thread being already
attached, while mono_get_root_domain() simply returns
the first created domain.

The latter is what you want in most of the cases.

Robert

On 06.08.2013 08:49, Chris Ochs wrote:
> Hmm, so mono_get_root_domain() doesn't segfault.
>
>
> On Mon, Aug 5, 2013 at 11:37 PM, Chris Ochs <chris at ochsnet.com> wrote:
>
>> Hey thanks that solved most of the problem.  I'm getting a segfault now
>> when I call mono_thread_attach(mono_domain_get()) at some point later in a
>> thread that's not the main thread.
>>
>> I have a functions to load the image, create objects, and call methods on
>> those objects.
>>
>> What works is if I create the image and objects in the main thread, then
>> make calls to the objects from any other java thread.  What's strange is
>> that when calling a method on the object in another thread,  if I pass
>> mono_domain_get() to mono_thread_attach it segfaults, but if I get the
>> domain by calling mono_object_get_domain on the object I am calling a
>> method on, it works fine.
>>
>> I'll post more info when I get it.  This kind of stuff might be good to
>> put in the embedding docs.
>>
>>
>> On Mon, Aug 5, 2013 at 6:52 AM, Rodrigo Kumpera <kumpera at gmail.com> wrote:
>>
>>> For Java, try this:
>>> http://docs.oracle.com/javase/6/docs/technotes/guides/vm/signal-chaining.html
>>>
>>>
>>> On Mon, Aug 5, 2013 at 1:49 AM, Chris Ochs <chris at ochsnet.com> wrote:
>>>
>>>> It appears that java and mono both use some of the same signals for GC
>>>> and pthreads, and step on each other.  If you embed mono in a java app it
>>>> works fine until you start spinning up other java threads, then it
>>>> eventually segfaults.  This happens even if you do nothing but call
>>>> mono_jit_init in the main thread.
>>>>
>>>>
>>>> On Fri, Aug 2, 2013 at 10:50 PM, snacktime <chris at ochsnet.com> wrote:
>>>>
>>>>> I'm embedding mono using C, which I'm calling from java.   I'm loading
>>>>> the
>>>>> mono runtime in the main thread.  That all works fine, until I load the
>>>>> rest
>>>>> of my app, at which point it segfaults.  It does this even when the only
>>>>> thing I do is call mono_jit_init().  My c method that calls that returns
>>>>> void, there are no references to anything from the mono side that I'm
>>>>> carrying around.
>>>>>
>>>>> I'd debug it with gdb but it's a jruby app, and I haven't figured out
>>>>> how to
>>>>> debug that under gdb.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://mono.1490590.n4.nabble.com/embeded-mono-segfaults-without-calling-managed-code-tp4660386.html
>>>>> Sent from the Mono - General mailing list archive at Nabble.com.
>>>>> _______________________________________________
>>>>> Mono-list maillist  -  Mono-list at lists.ximian.com
>>>>> http://lists.ximian.com/mailman/listinfo/mono-list
>>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Mono-list maillist  -  Mono-list at lists.ximian.com
>>>> http://lists.ximian.com/mailman/listinfo/mono-list
>>>>
>>>>
>>>
>>
>
>
>
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list
>



More information about the Mono-list mailing list