Mono crash when executing an extenal command
Tom McLaughlin
tmclaugh at sdf.lonestar.org
Mon Feb 28 05:48:06 GMT 2005
Hi, the backtrace listed at the end was collected on a -STABLE machine
(20050219) using Mono 1.1.4[1]. Below is the C# code that caused it.
It should just list the contents of the current directory. It does list
them but crashes afterwards.
ls-exec.cs
---
using System.Diagnostics;
class T
{
static void Main()
{
Process.Start ("ls");
}
}
---
Using Process.Start in C# to invoke an external command consistently
causes Mono to crash. Can someone take a look at this? Is this a
FreeBSD bug in libpthread or possibly a Mono on FreeBSD bug. In case of
the latter would anyone be able to fix it? I am C clueless here. Let
me know if you have any questions. Thanks.
Tom
[1] Mono 1.1.4 port:
http://tmclaugh.freeshell.org/files/mono/mono-devel-1.1.4.shar
backtrace:
[tom at europe-monodev mono]$ mcs ls-exec.cs
[tom at europe-monodev mono]$ gdb /usr/local/bin/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"...
Program exited with code 02.
(gdb) run ls-exec.exe
Starting program: /usr/local/bin/mono ls-exec.exe
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 100180)]
0x2836b27c in _lock_acquire (lck=0x823dd80, lu=0x81b0048, prio=0)
at /usr/src/lib/libpthread/sys/lock.c:182
182 /usr/src/lib/libpthread/sys/lock.c: No such file or directory.
in /usr/src/lib/libpthread/sys/lock.c
(gdb) hello-world_gtk-sharp.cs switches-fixed.cs
ls-exec.cs switches-fixed.exe
ls-exec.exe switches.cs
mcs_crash.cs switches.exe
mono.core
(gdb) bt full
#0 0x2836b27c in _lock_acquire (lck=0x823dd80, lu=0x81b0048, prio=0)
at /usr/src/lib/libpthread/sys/lock.c:182
i = 0
lval = -1077942736
__func__ = "_lock_acquire"
#1 0x2835e537 in mutex_lock_common (curthread=0x81b0000, m=0x28566188,
abstime=0x0) at /usr/src/lib/libpthread/thread/thr_mutex.c:519
private = 0
ret = 0
#2 0x2835fb03 in __pthread_mutex_lock (m=0x28566188)
at /usr/src/lib/libpthread/thread/thr_mutex.c:844
curthread = (struct pthread *) 0x81b0000
ret = 0
#3 0x080e8af9 in WaitForSingleObjectEx (handle=0x1e22, timeout=500,
alertable=0) at handles-private.h:100
ret = 135133339
waited = 1
abstime = {tv_sec = 11180, tv_nsec = 11072}
thr_ret = 0
apc_pending = 0
current_thread = 0x1e17
__PRETTY_FUNCTION__ = "WaitForSingleObjectEx"
#4 0x080df8d6 in CreateProcess (appname=0x1, cmdline=0x8278fec,
process_attrs=0x0, thread_attrs=0x0, inherit_handles=1,
create_flags=1024,
new_environ=0x0, cwd=0x0, startup=0xbfbfe7d0,
process_info=0xbfbfe7c0)
at processes.c:437
cmd = (gchar *) 0x82b8680 "/usr/local/bin/ksh"
prog = (gchar *) 0x82b8720 "/usr/local/bin/ksh"
full_prog = (gchar *) 0x82b8780 "'/usr/local/bin/ksh' -c 'ls'"
args = (gchar *) 0x82b7860 "-c 'ls'"
args_after_prog = (gchar *) 0x82b7860 "-c 'ls'"
dir = (gchar *) 0x82b8700 "/home/tom/projects/mono"
env = 11072
stored_dir = 10136
stored_prog = 11180
i = 1
ret = 1
stdin_handle = 0xbfbfe7c0
stdout_handle = 0x1
stderr_handle = 0x0
pid = 26334
tid = 0
process_handle = 0x1e22
thread_handle = 0x1e23
process_handle_data = (struct _WapiHandle_process *) 0xbfbfe768
#5 0x080b764c in ves_icall_System_Diagnostics_Process_Start_internal (
appname=0x0, cmd=0x8278fe0, dirname=0x81e6e30, stdin_handle=0x0,
stdout_handle=0x0, stderr_handle=0x0, process_info=0xbfbfe8e8)
at process.c:847
ret = 137067008
dir = (gunichar2 *) 0x0
startinfo = {cb = 68, lpReserved = 0x0, lpDesktop = 0x0,
lpTitle = 0x0, dwX = 0, dwY = 0, dwXSize = 0, dwYSize = 0,
dwXCountChars = 0, dwYCountChars = 0, dwFillAttribute = 0,
dwFlags = STARTF_USESTDHANDLES, wShowWindow = 0, cbReserved2 = 0,
lpReserved2 = 0x0, hStdInput = 0x0, hStdOutput = 0x1, hStdError = 0x2}
procinfo = {hProcess = 0x1e22, hThread = 0x1e23, dwProcessId =
26334,
dwThreadId = 0}
shell_path = (gunichar2 *) 0x82ba1c0
env_vars = (gchar *) 0x0
free_shell_path = 0
newcmd = (gchar *) 0xbfbfe8e8 ""
tmp = (gchar *) 0x82b7860 "-c 'ls'"
#6 0x2863a27e in ?? ()
No symbol table info available.
#7 0x00000000 in ?? ()
No symbol table info available.
#8 0x08278fe0 in ?? ()
No symbol table info available.
#9 0x081e6e30 in ?? ()
No symbol table info available.
#10 0x00000000 in ?? ()
No symbol table info available.
#11 0x00000001 in ?? ()
No symbol table info available.
#12 0x00000002 in ?? ()
No symbol table info available.
#13 0xbfbfe8e8 in ?? ()
No symbol table info available.
#14 0x081a71e0 in ?? ()
No symbol table info available.
#15 0x081a71c8 in ?? ()
No symbol table info available.
#16 0x0829afc0 in ?? ()
No symbol table info available.
#17 0x00000000 in ?? ()
No symbol table info available.
#18 0x08275fa0 in ?? ()
No symbol table info available.
#19 0x081eaf30 in ?? ()
No symbol table info available.
#20 0xbfbfe87c in ?? ()
No symbol table info available.
#21 0x2863a24c in ?? ()
No symbol table info available.
#22 0xbfbfe914 in ?? ()
No symbol table info available.
#23 0x28639725 in ?? ()
No symbol table info available.
#24 0x00000000 in ?? ()
No symbol table info available.
#25 0x081ebfc0 in ?? ()
No symbol table info available.
#26 0x081e6e30 in ?? ()
No symbol table info available.
#27 0x00000000 in ?? ()
No symbol table info available.
#28 0x00000001 in ?? ()
No symbol table info available.
#29 0x00000002 in ?? ()
No symbol table info available.
#30 0xbfbfe8e8 in ?? ()
No symbol table info available.
#31 0xbfbfe8c0 in ?? ()
No symbol table info available.
#32 0x08070f7f in x86_magic_trampoline (eax=0, ecx=136232896,
edx=136212016,
esi=0, edi=1, ebx=2, code=0x81eaf30 "\200\236\033\b", m=0xbfbfe8c0)
at tramp-x86.c:123
reg = 8 '\b'
disp = 0
o = 0x1 <Error reading address 0x1: Bad address>
addr = 0x8275fa0
__PRETTY_FUNCTION__ = "x86_magic_trampoline"
Previous frame inner to this frame (corrupt stack?)
(gdb)
--
BSD# Project - Porting Mono to FreeBSD
http://forge.novell.com/modules/xfmod/project/?bsd-sharp
More information about the freebsd-threads
mailing list