I've run into a qemu crash with the following trace:
#0 _thread_kern_sig_undefer ()
at /usr/src/lib/libpthread/uthread/uthread_kern.c:1003
1003 if (curthread->sig_defer_count > 1) {
(gdb) p curthread
$1 = (struct pthread *) 0x8
(gdb) bt
#0 _thread_kern_sig_undefer ()
at /usr/src/lib/libpthread/uthread/uthread_kern.c:1003
#1 0x0000000209fbb039 in _thread_kern_sig_defer ()
at /usr/src/lib/libpthread/uthread/uthread_kern.c:988
#2 0x0000000209fb6d82 in _thread_fd_unlock (fd=Variable "fd" is not available.
)
at /usr/src/lib/libpthread/uthread/uthread_fd.c:568
#3 0x0000000209fb5a14 in write (fd=121237504, buf=0x651d90, nbytes=8)
at /usr/src/lib/libpthread/uthread/uthread_write.c:170
#4 0x00000000004070af in ?? ()
#5 0x0000000000423b61 in ?? ()
#6 0x0000000209fbcb06 in _dispatch_signal (sig=31, scp=0x202612ac0)
at /usr/src/lib/libpthread/uthread/uthread_sig.c:400
#7 0x0000000209fbcbe3 in _dispatch_signals (scp=0x202612ac0)
at /usr/src/lib/libpthread/uthread/uthread_sig.c:429
#8 0x0000000209fbd31d in _thread_sig_handler (sig=14, info=0x202612ba0,
scp=0x202612ac0) at /usr/src/lib/libpthread/uthread/uthread_sig.c:139
#9 0x0000000202612ac0 in ?? ()
#10 0x000000020739f190 in ?? ()
#11 0x000000020739f000 in ?? ()
#12 0x0000000000000004 in ?? ()
#13 0x000000004d38f2e5 in ?? ()
#14 0x00000000
Note that call to write() which gets a bogus fd.
This fd is io_thread_fd in the patch below.
This seems to help stability here.
It would be interesting to know if this helps others who have seen qemu crash.
Index: Makefile
===================================================================
RCS file: /cvs/ports/emulators/qemu/Makefile,v
retrieving revision 1.59
diff -u -p -r1.59 Makefile
--- Makefile 22 Nov 2010 11:32:01 -0000 1.59
+++ Makefile 21 Jan 2011 09:28:07 -0000
@@ -6,6 +6,7 @@ ONLY_FOR_ARCHS = i386 amd64 sparc64
COMMENT = multi system emulator
DISTNAME = qemu-0.13.0
+REVISION = 0
CATEGORIES = emulators
HOMEPAGE = http://www.qemu.org/
Index: patches/patch-cpus_c
===================================================================
RCS file: patches/patch-cpus_c
diff -N patches/patch-cpus_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-cpus_c 21 Jan 2011 09:27:20 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- cpus.c.orig Fri Jan 21 10:24:52 2011
++++ cpus.c Fri Jan 21 10:26:29 2011
+@@ -149,7 +149,7 @@ static void cpu_debug_handler(CPUState *env)
+ }
+
+ #ifndef _WIN32
+-static int io_thread_fd = -1;
++static volatile sig_atomic_t io_thread_fd = -1;
+
+ static void qemu_event_increment(void)
+ {
Index: patches/patch-net_h
===================================================================
RCS file: /cvs/ports/emulators/qemu/patches/patch-net_h,v
retrieving revision 1.1
diff -u -p -r1.1 patch-net_h
--- patches/patch-net_h 27 May 2010 17:55:05 -0000 1.1
+++ patches/patch-net_h 21 Jan 2011 09:27:19 -0000
@@ -1,7 +1,7 @@
$OpenBSD: patch-net_h,v 1.1 2010/05/27 17:55:05 fgsch Exp $
---- net.h.orig Tue Feb 23 20:54:38 2010
-+++ net.h Mon Mar 22 20:26:50 2010
-@@ -172,7 +172,7 @@ void net_host_device_remove(Monitor *mon, const QDict
+--- net.h.orig Fri Oct 15 22:56:09 2010
++++ net.h Fri Jan 21 10:04:46 2011
+@@ -172,7 +172,7 @@ int do_netdev_del(Monitor *mon, const QDict *qdict, QO
#ifdef __sun__
#define SMBD_COMMAND "/usr/sfw/sbin/smbd"
#else
Index: patches/patch-posix-aio-compat_c
===================================================================
RCS file: patches/patch-posix-aio-compat_c
diff -N patches/patch-posix-aio-compat_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-posix-aio-compat_c 21 Jan 2011 09:27:20 -0000
@@ -0,0 +1,12 @@
+$OpenBSD$
+--- posix-aio-compat.c.orig Fri Jan 21 10:27:04 2011
++++ posix-aio-compat.c Fri Jan 21 10:15:20 2011
+@@ -495,7 +495,7 @@ static int posix_aio_flush(void *opaque)
+ return !!s->first_aio;
+ }
+
+-static PosixAioState *posix_aio_state;
++static volatile PosixAioState *posix_aio_state;
+
+ static void aio_signal_handler(int signum)
+ {
Index: patches/patch-qemu-options_hx
===================================================================
RCS file: /cvs/ports/emulators/qemu/patches/patch-qemu-options_hx,v
retrieving revision 1.1
diff -u -p -r1.1 patch-qemu-options_hx
--- patches/patch-qemu-options_hx 27 May 2010 17:55:05 -0000 1.1
+++ patches/patch-qemu-options_hx 21 Jan 2011 09:27:19 -0000
@@ -1,7 +1,7 @@
$OpenBSD: patch-qemu-options_hx,v 1.1 2010/05/27 17:55:05 fgsch Exp $
---- qemu-options.hx.orig Tue Feb 23 20:54:38 2010
-+++ qemu-options.hx Mon Mar 22 20:26:50 2010
-@@ -942,7 +942,7 @@ or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windo
+--- qemu-options.hx.orig Fri Oct 15 22:56:09 2010
++++ qemu-options.hx Fri Jan 21 10:04:46 2011
+@@ -1105,7 +1105,7 @@ or @file{C:\WINNT\SYSTEM32\DRIVERS\ETC\LMHOSTS} (Windo
Then @file{@var{dir}} can be accessed in @file{\\smbserver\qemu}.
Note that a SAMBA server must be installed on the host OS in