Date: Mon, 03 May 2004 01:52:43 +0200 From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) To: Archie Cobbs <archie@dellroad.org> Cc: julian@elischer.org Subject: Re: libthr, libpthread problems Message-ID: <xzp4qqyo08k.fsf@dwp.des.no> In-Reply-To: <200405011757.i41HvHrM001972@arch20m.dellroad.org> (Archie Cobbs's message of "Sat, 1 May 2004 12:57:17 -0500 (CDT)") References: <200405011757.i41HvHrM001972@arch20m.dellroad.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Archie Cobbs <archie@dellroad.org> writes: > Dan Eischen wrote: > > Sounds like a bug in the application (recurse count shouldn't > > be less than zero). > Nope.. here's a simpler test case that demonstrates the problem: Perfectly reproducable, definitely a libthr bug: des@dwp ~% cat xx.c #include <stdio.h> #include <pthread.h> #include <err.h> static pthread_mutex_t mutex; int main(int argc, char **argv) { pthread_mutexattr_t mattr; pthread_mutexattr_init(&mattr); pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init(&mutex, &mattr); pthread_mutexattr_destroy(&mattr); pthread_mutex_lock(&mutex); pthread_mutex_unlock(&mutex); return 0; } des@dwp ~% cc -Wall -pedantic -o xx xx.c -lpthread des@dwp ~% ldd ./xx ./xx: libpthread.so.1 =3D> /usr/lib/libpthread.so.1 (0x2807b000) libc.so.5 =3D> /lib/libc.so.5 (0x2809d000) des@dwp ~% ./xx des@dwp ~% cc -Wall -pedantic -o xx xx.c -lthr des@dwp ~% ldd ./xx ./xx: libthr.so.1 =3D> /usr/lib/libthr.so.1 (0x2807b000) libc.so.5 =3D> /lib/libc.so.5 (0x28094000) des@dwp ~% ./xx The mutex recurse count cannot be less than zero Abnormal termination, file: /usr/src/lib/libthr/thread/thr_mutex.c, line: 6= 77 zsh: abort (core dumped) ./xx des@dwp ~% gdb xx xx.core GNU gdb 5.2.1 (FreeBSD) Copyright 2002 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 condition= s. 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-undermydesk-freebsd"... Core was generated by `xx'. Program terminated with signal 6, Aborted. Reading symbols from /usr/lib/libthr.so.1...done. Loaded symbols for /usr/lib/libthr.so.1 Reading symbols from /lib/libc.so.5...done. Loaded symbols for /lib/libc.so.5 Reading symbols from /libexec/ld-elf.so.1...done. Loaded symbols for /libexec/ld-elf.so.1 #0 0x280d85d3 in thr_kill () at {standard input}:15 15 {standard input}: No such file or directory. in {standard input} (gdb) where #0 0x280d85d3 in thr_kill () at {standard input}:15 #1 0x28082d14 in _pthread_kill (pthread=3D0x804b000, sig=3D6) at /usr/src/lib/libthr/thread/thr_sig.c:94 #2 0x28082921 in _raise (sig=3D6) at /usr/src/lib/libthr/thread/thr_syscalls.c:282 #3 0x2813b5a0 in abort () at /usr/src/lib/libc/stdlib/abort.c:69 #4 0x2808570d in mutex_unlock_common (mutex=3D0x804989c, add_reference=3D0) at /usr/src/lib/libthr/thread/thr_mutex.c:716 #5 0x28085460 in __pthread_mutex_unlock (mutex=3D0x804989c) at /usr/src/lib/libthr/thread/thr_mutex.c:587 #6 0x080486bc in main () #7 0x0804859b in _start (ap=3D0xbfbfe768 "./xx") at /usr/src/lib/csu/i386-elf/crt1.c:104 Current language: auto; currently asm (gdb) up 4 #4 0x2808570d in mutex_unlock_common (mutex=3D0x804989c, add_reference=3D0) at /usr/src/lib/libthr/thread/thr_mutex.c:716 716 restore_prio_inheritance(curthread); DES --=20 Dag-Erling Sm=F8rgrav - des@des.no
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzp4qqyo08k.fsf>