[Mono-dev] Mono 2.0 and FreeBSD

Konstantin Morshnev moko at design.ru
Tue Dec 9 11:01:38 EST 2008


Dear Romain,

>>> As for the exception failures, running configure with
>>> ./configure --with-sigaltstack=no
>>> might help.
>> Just tried it. Instead of hanging-on, mono aborts. The backtrace in gdb
>> is almost the same, plus ~10 frames that look consistent and are related
>> to signal handling
> 
> Wow! I have just discovered that a patch in the FreeBSD port remove the
> explicit activation of sigaltstack [1]. I removed all patches we provide
> and only kept path fixes (e.g. /usr/bin/env {bash,perl} instead of
> /bin/{bash,perl}).
> 
> The result is exactly the same (with a backtrace for all threads).  You
> can consider this "vanilla mono 2.0.1":

The problem is indeed related to ALTSTACK. I have posted a bug about SIGSEGV,
with the following workaround:

Add in mono.c
#undef MONO_ARCH_SIGSEGV_ON_ALTSTACK

https://bugzilla.novell.com/show_bug.cgi?id=448131

> | $ gdb ../mini/mono
> | GNU gdb 6.1.1 [FreeBSD]
> | Copyright 2004 Free Software Foundation, Inc.
> | GDB is free software, covered by the GNU General Public License, and you are
> | welcome to change it and/or distribute copies of it under certain conditions.
> | Type "show copying" to see the conditions.
> | There is absolutely no warranty for GDB.  Type "show warranty" for details.
> | This GDB was configured as "i386-marcel-freebsd"...
> | (gdb) r exception.exe
> | Starting program: /usr/home/romain/Projects/BSD-sharp-latest/lang/mono/work/mono-2.0.1/mono/mini/mono exception.exe
> | [New LWP 100408]
> | [New Thread 0x29501100 (LWP 100408)]
> | [New Thread 0x29564100 (LWP 100388)]
> | [New Thread 0x29564c00 (LWP 100443)]
> | 
> | Program received signal SIGFPE, Arithmetic exception.
> | [Switching to Thread 0x29501100 (LWP 100408)]
> | 0x294dc2d3 in ?? ()
> | (gdb) thread apply all bt
> | 
> | Thread 4 (Thread 0x29564c00 (LWP 100443)):
> | #0  0x286ad3a3 in _umtx_op_err () at /usr/src/lib/libthr/arch/i386/i386/_umtx_op_err.S:36
> | #1  0x286ad141 in _thr_ucond_wait (cv=0x2956eae0, m=0x2956eac0, timeout=0x0, check_unparking=1)
> |     at /usr/src/lib/libthr/thread/thr_umtx.c:129
> | #2  0x286abb6d in cond_wait_common (cond=Variable "cond" is not available.
> | ) at /usr/src/lib/libthr/thread/thr_cond.c:204
> | #3  0x08191281 in timedwait_signal_poll_cond (cond=0x295740f0, mutex=0x295740ec, timeout=0x0, alertable=0)
> |     at handles.c:1490
> | #4  0x081915c6 in _wapi_handle_timedwait_signal_handle (handle=0x5804, timeout=0x0, alertable=0)
> |     at handles.c:1570
> | #5  0x081913cc in _wapi_handle_wait_signal_handle (handle=0x5804, alertable=0) at handles.c:1530
> | #6  0x081afbf8 in WaitForSingleObjectEx (handle=0x5804, timeout=4294967295, alertable=0) at wait.c:205
> | #7  0x0810182f in finalizer_thread (unused=0x0) at gc.c:908
> | #8  0x08122d52 in start_wrapper (data=0x2956f960) at threads.c:621
> | #9  0x081a9d8a in thread_start_routine (args=0x295741d4) at threads.c:279
> | #10 0x081cd98e in GC_start_routine (arg=0x832bec0) at pthread_support.c:1382
> | #11 0x286a5865 in thread_start (curthread=0x29564c00) at /usr/src/lib/libthr/thread/thr_create.c:256
> | #12 0x00000000 in ?? ()
> | Current language:  auto; currently asm
> | 
> | Thread 3 (Thread 0x29564100 (LWP 100388)):
> | #0  0x28769f53 in nanosleep () at nanosleep.S:2
> | #1  0x286a47e2 in __nanosleep (time_to_sleep=0xbf9fef8c, time_remaining=0x0)
> |     at /usr/src/lib/libthr/thread/thr_syscalls.c:306
> | #2  0x0818bcf5 in collection_thread (unused=0x0) at collection.c:34
> | #3  0x286a5865 in thread_start (curthread=0x29564100) at /usr/src/lib/libthr/thread/thr_create.c:256
> | #4  0x00000000 in ?? ()
> | 
> | Thread 2 (Thread 0x29501100 (LWP 100408)):
> | #0  0x294dc2d3 in ?? ()
> | #1  0xbfbfe774 in ?? ()
> | #2  0xbfbfe474 in ?? ()
> | #3  0x00000000 in ?? ()
> | #4  0x00000000 in ?? ()
> | #5  0x00000000 in ?? ()
> | #6  0x00000001 in ?? ()
> | #7  0x00000000 in ?? ()
> | #8  0x2951903c in ?? ()
> | #9  0xbfbfe458 in ?? ()
> | #10 0xbfbfe474 in ?? ()
> | #11 0xbfbfe774 in ?? ()
> | ---Type <return> to continue, or q <return> to quit---
> | #12 0x0000000a in ?? ()
> | #13 0xbfbfe474 in ?? ()
> | #14 0x294dc259 in ?? ()
> | #15 0x00000000 in ?? ()
> | #16 0x00000000 in ?? ()
> | #17 0xbfbfe498 in ?? ()
> | #18 0x294dc1b7 in ?? ()
> | #19 0x080d935e in mono_custom_attrs_from_index (image=0x0, idx=0) at reflection.c:7730
> | Previous frame inner to this frame (corrupt stack?)
> | (gdb) 
> 
> With regards,
> Romain
> 
> References:
>   1. http://code.google.com/p/bsd-sharp/source/browse/trunk/lang/mono/files/patch-configure
> ------------------------------------------------------------------------

WBR, MoKo


More information about the Mono-devel-list mailing list