[Mono-dev] Multiple Segfaults on mono

Dick Porter dick at ximian.com
Wed May 17 05:37:10 EDT 2006

On Tue, 2006-05-16 at 16:08 +1000, kingos at optusnet.com.au wrote:
> Hi all,
> I am getting a segfault with the mono runtime, and since I couldn't find it in bugzilla,
> thought I would check with the list if it has been fixed.
> Unfortunately, the program is proprietary, so I cannot hand out the source. If more details
> are required however, I can try and isolate it more ... Other important details are that I
> compile the program using the Microsoft compiler ... I have not tested it with the mono
> compiler.
> The program loads some config, connects to a network socket via an asynchronous tcp
> connection, does a bunch of things, and then exits. It segfaults if I call
> Environment.Exit(1), rather than exiting cleanly. I "think" it does not segfault
> when I explicitly Disconnect the socket before exiting. Yeah, ugly code not to disconnect,
> but it shouldn't crash the runtime ... 

Environment.Exit() causing a crash rings a bell, but I can't think of
the specifics right now.

> This is what the backtrace looks like:
> #0  0x006becae in __pthread_mutex_lock (mutex=0x74c008) at pthread_mutex_lock.c:76
> #1  0x08108242 in mono_once ()
> #2  0x080da7bf in mono_jit_info_table_find ()
> #3  0x0813ba64 in mono_codegen ()
> #4  <signal handler called>
> #5  0x080a5222 in mono_thread_pool_remove_socket ()
> #6  0x080a42e3 in mono_debug_address_from_il_offset ()
> #7  0x08099ff2 in mono_thread_get_tls_offset ()
> #8  0x080f5227 in mono_environment_exitcode_set ()
> #9  0x08113945 in GC_end_blocking ()
> #10 0x006bd341 in start_thread (arg=0x1963bb0) at pthread_create.c:261
> #11 0x004176fe in ?? () from /lib/tls/libc.so.6

That backtrace looks fairly garbled to me.  Is this extracted from a
core dump or did you run your app through gdb?

> Ah, actually, after I change the code to explicitly call Disconnect on the sockets before
> calling Environment.Exit(1), I am now getting a different segfault ...

That trace doesn't help much either.

> mono --version
> Mono JIT compiler version, (C) 2002-2005 Novell, Inc and Contributors. 

Could you try a newer version (either later 1.1.13 or head), compiled
with debugging symbols?  And if you extracted the backtrace from a core
dump, running it in gdb might generate better information.  You need to
tell gdb:

handle SIGPWR SIGXCPU nostop noprint pass

before you start executing.

> The machine has 4 intel xeon cpus.

Does anything change if you run on a single processor machine?

- Dick

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060517/f82a3efb/attachment.bin 

More information about the Mono-devel-list mailing list