From owner-freebsd-threads@FreeBSD.ORG Sat May 1 13:02:37 2004 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 884FF16A4CE for ; Sat, 1 May 2004 13:02:37 -0700 (PDT) Received: from mxsf20.cluster1.charter.net (mxsf20.cluster1.charter.net [209.225.28.220]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3321643D2D for ; Sat, 1 May 2004 13:02:36 -0700 (PDT) (envelope-from archie@dellroad.org) Received: from InterJet.dellroad.org (public.cpe.mvllo.al.charter.com [24.196.20.72])i41K05X3090758 for ; Sat, 1 May 2004 16:00:05 -0400 (EDT) Received: from arch20m.dellroad.org (arch20m.dellroad.org [10.2.2.20]) by InterJet.dellroad.org (8.9.1a/8.9.1) with ESMTP id OAA51039 for ; Sat, 1 May 2004 14:51:02 -0500 (CDT) Received: from arch20m.dellroad.org (localhost [127.0.0.1]) i41Jp08l002437 for ; Sat, 1 May 2004 14:51:00 -0500 (CDT) (envelope-from archie@arch20m.dellroad.org) Received: (from archie@localhost) by arch20m.dellroad.org (8.12.9p2/8.12.9/Submit) id i41Jp0I1002436 for freebsd-threads@freebsd.org; Sat, 1 May 2004 14:51:00 -0500 (CDT) (envelope-from archie) From: Archie Cobbs Message-ID: <200405011757.i41HvHrM001972@arch20m.dellroad.org> To: eischen@vigrid.com, julian@elischer.org Date: Sat, 1 May 2004 12:57:17 -0500 (CDT) X-Mailer: ELM [version 2.4ME+ PL99b (25)] MIME-Version: 1.0 Sender: archie@dellroad.org cc: mbretter@a-quadrat.at cc: freebsd-threads@freebsd.org Subject: Re: libthr, libpthread problems X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 01 May 2004 20:02:37 -0000 Dan Eischen wrote: > On Thu, 29 Apr 2004, Michael Bretterklieber wrote: > > currently I'm testing Mpd-4 on -current and It ran into deadlock, > > therefore I changed the lib mapping via libmap.conf. When using libc_r > > everything is ok, when using libpthread a deadlock occurs under some > > circumstances, when using libthr, then: > > > > elvis:/home/mbretter/mpd/src# ./mpd > > Multi-link PPP for FreeBSD, by Archie L. Cobbs. > > Based on iij-ppp, by Toshiharu OHNO. > > The mutex recurse count cannot be less than zero > > 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: $ cat xx.c #include #include #include 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; } $ cc -g -Wall -o xx xx.o -pthread $ ./xx The mutex recurse count cannot be less than zero Abnormal termination, file: /usr/src/lib/libthr/thread/thr_mutex.c, line: 677 Abort $ uname -r 5.2-CURRENT $ ldd ./xx ./xx: libpthread.so.1 => /usr/lib/libthr.so.1 (0x2807b000) libc.so.5 => /lib/libc.so.5 (0x28094000) Seems to be PTHREAD_MUTEX_RECURSIVE-specific. -Archie __________________________________________________________________________ Archie Cobbs * CTO, Awarix * http://www.awarix.com