From owner-freebsd-threads@FreeBSD.ORG Mon Apr 18 01:11:20 2005 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 C48E316A4CE for ; Mon, 18 Apr 2005 01:11:20 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id AE48A43D45; Mon, 18 Apr 2005 01:11:20 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from [127.0.0.1] (davidxu@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j3I1BIxa089939; Mon, 18 Apr 2005 01:11:19 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4263095F.3040102@freebsd.org> Date: Mon, 18 Apr 2005 09:11:59 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.6) Gecko/20050319 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Archie Cobbs References: <425FD527.1000102@dellroad.org> In-Reply-To: <425FD527.1000102@dellroad.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-threads@freebsd.org Subject: Re: Bug with pthread_getspecific() and signals 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: Mon, 18 Apr 2005 01:11:20 -0000 Archie Cobbs wrote: > On FreeBSD 4.9 I'm seeing a bug where pthread_getspecific() sometimes > returns the wrong value when invoked from within a signal handler. > > ISTR this bug was fixed in a later version of FreeBSD. However, I can't > seem to find any reference to the bug, any information about when > it was fixed, etc. (FreeBSD's mailing list search ability doesn't > help much). > > If anyone knows any more details about this bug I'd appreciate knowing > any more details. > > Thanks, > -Archie > > __________________________________________________________________________ > > Archie Cobbs * CTO, Awarix * > http://www.awarix.com Does POSIX say that pthread_getspecific can be used in signal handler ? David Xu From owner-freebsd-threads@FreeBSD.ORG Mon Apr 18 01:45:05 2005 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 A646216A4CE; Mon, 18 Apr 2005 01:45:05 +0000 (GMT) Received: from mxsf09.cluster1.charter.net (mxsf09.cluster1.charter.net [209.225.28.209]) by mx1.FreeBSD.org (Postfix) with ESMTP id 377B943D2D; Mon, 18 Apr 2005 01:45:05 +0000 (GMT) (envelope-from archie@dellroad.org) Received: from mxip18.cluster1.charter.net (mxip18a.cluster1.charter.net [209.225.28.148])j3I1j3DV010045; Sun, 17 Apr 2005 21:45:03 -0400 Received: from cable-68-113-94-164.mtv.al.charter.com (HELO InterJet.dellroad.org) (68.113.94.164) by mxip18.cluster1.charter.net with ESMTP; 17 Apr 2005 21:45:03 -0400 X-Ironport-AV: i="3.92,106,1112587200"; d="scan'208"; a="1029577982:sNHT14774244" 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 UAA44964; Sun, 17 Apr 2005 20:37:32 -0500 (CDT) Received: from [127.0.0.1] (localhost [127.0.0.1])j3I1bVZK008905; Sun, 17 Apr 2005 20:37:31 -0500 (CDT) (envelope-from archie@dellroad.org) Message-ID: <42630F5B.9040306@dellroad.org> Date: Sun, 17 Apr 2005 20:37:31 -0500 From: Archie Cobbs User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129 X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Xu References: <425FD527.1000102@dellroad.org> <4263095F.3040102@freebsd.org> In-Reply-To: <4263095F.3040102@freebsd.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-threads@freebsd.org Subject: Re: Bug with pthread_getspecific() and signals 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: Mon, 18 Apr 2005 01:45:05 -0000 David Xu wrote: >> On FreeBSD 4.9 I'm seeing a bug where pthread_getspecific() sometimes >> returns the wrong value when invoked from within a signal handler. > > Does POSIX say that pthread_getspecific can be used in signal handler ? Not sure.. where do I check for that? In any case, pthread_self() is also returning the wrong value (presumably for the same reason). Unfortunately I haven't come up with a small test case yet. Could it be related to this bug? http://lists.freebsd.org/pipermail/freebsd-threads/2004-October/002618.html I ran the test program (on 4.9) and it seemed to work properly.. ? Thanks, -Archie __________________________________________________________________________ Archie Cobbs * CTO, Awarix * http://www.awarix.com From owner-freebsd-threads@FreeBSD.ORG Mon Apr 18 04:34:19 2005 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 402DA16A4CE; Mon, 18 Apr 2005 04:34:19 +0000 (GMT) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id AF04F43D5D; Mon, 18 Apr 2005 04:34:18 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) j3I4YGf5018309; Mon, 18 Apr 2005 00:34:16 -0400 (EDT) Date: Mon, 18 Apr 2005 00:34:16 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: David Xu In-Reply-To: <4263095F.3040102@freebsd.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) cc: Archie Cobbs cc: freebsd-threads@freebsd.org Subject: Re: Bug with pthread_getspecific() and signals X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Daniel Eischen List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2005 04:34:19 -0000 On Mon, 18 Apr 2005, David Xu wrote: > Archie Cobbs wrote: > > > On FreeBSD 4.9 I'm seeing a bug where pthread_getspecific() sometimes > > returns the wrong value when invoked from within a signal handler. > > > > ISTR this bug was fixed in a later version of FreeBSD. However, I can't > > seem to find any reference to the bug, any information about when > > it was fixed, etc. (FreeBSD's mailing list search ability doesn't > > help much). > > > > If anyone knows any more details about this bug I'd appreciate knowing > > any more details. > > Does POSIX say that pthread_getspecific can be used in signal handler ? I don't think using it in a signal handler should cause a problem for our implementation though. Probably the real problem is that the signal handler is not running in the expected thread. I'd double check the signal masks and make sure there is only one thread that could possibly handle the signal. -- DE From owner-freebsd-threads@FreeBSD.ORG Mon Apr 18 11:02:18 2005 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 8F36F16A4E3 for ; Mon, 18 Apr 2005 11:02:18 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6965943D1F for ; Mon, 18 Apr 2005 11:02:18 +0000 (GMT) (envelope-from owner-bugmaster@freebsd.org) Received: from freefall.freebsd.org (peter@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j3IB2IcT093441 for ; Mon, 18 Apr 2005 11:02:18 GMT (envelope-from owner-bugmaster@freebsd.org) Received: (from peter@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j3IB2GcA093434 for freebsd-threads@freebsd.org; Mon, 18 Apr 2005 11:02:16 GMT (envelope-from owner-bugmaster@freebsd.org) Date: Mon, 18 Apr 2005 11:02:16 GMT Message-Id: <200504181102.j3IB2GcA093434@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: peter set sender to owner-bugmaster@freebsd.org using -f From: FreeBSD bugmaster To: freebsd-threads@FreeBSD.org Subject: Current problem reports assigned to you 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: Mon, 18 Apr 2005 11:02:18 -0000 Current FreeBSD problem reports Critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2004/04/22] threads/65883threads libkse's sigwait does not work after fork o [2005/01/26] threads/76690threads fork hang in child for (-lc_r & -lthr) 2 problems total. Serious problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2000/07/18] kern/20016 threads pthreads: Cannot set scheduling timer/Can o [2000/08/26] kern/20861 threads libc_r does not honor socket timeouts o [2001/01/20] threads/24472threads libc_r does not honor SO_SNDTIMEO/SO_RCVT o [2001/01/25] threads/24632threads libc_r delicate deviation from libc in ha o [2001/01/25] kern/24641 threads pthread_rwlock_rdlock can deadlock o [2001/11/26] bin/32295 threads pthread dont dequeue signals o [2002/02/01] threads/34536threads accept() blocks other threads o [2002/05/25] kern/38549 threads the procces compiled whith pthread stoppe o [2002/06/27] threads/39922threads [PATCH?] Threaded applications executed w o [2002/08/04] kern/41331 threads Pthread library open sets O_NONBLOCK flag o [2003/03/02] threads/48856threads Setting SIGCHLD to SIG_IGN still leaves z o [2003/03/10] threads/49087threads Signals lost in programs linked with libc o [2003/05/08] threads/51949threads thread in accept cannot be cancelled s [2004/03/15] kern/64313 threads FreeBSD (OpenBSD) pthread implicit set/un o [2004/08/26] threads/70975threads unexpected and unreliable behaviour when o [2004/09/14] threads/71725threads Mysql Crashes frequently giving Sock Erro o [2004/10/05] threads/72353threads Assertion fails in /usr/src/lib/libpthrea o [2004/10/07] threads/72429threads threads blocked in stdio (fgets, etc) are o [2004/10/21] threads/72953threads fork() unblocks blocked signals w/o PTHRE o [2004/11/25] threads/74370threads Cannot get lwp 0 registers in gdb o [2004/12/19] threads/75273threads FBSD 5.3 libpthread (KSE) bug o [2004/12/21] threads/75374threads pthread_kill() ignores SA_SIGINFO flag o [2005/01/04] threads/75795threads applications linked with -lc_r can't clos o [2005/01/26] threads/76694threads fork cause hang in dup()/close() function o [2005/03/10] threads/78660threads Java hangs unkillably in STOP state after o [2005/04/08] threads/79683threads svctcp_create() fails if multiple threads 26 problems total. Non-critical problems S Submitted Tracker Resp. Description ------------------------------------------------------------------------------- o [2000/05/26] kern/18824 threads gethostbyname is not thread safe o [2000/06/13] kern/19247 threads uthread_sigaction.c does not do anything o [2000/10/21] kern/22190 threads A threaded read(2) from a socketpair(2) f o [2001/09/09] threads/30464threads pthread mutex attributes -- pshared o [2002/05/02] threads/37676threads libc_r: msgsnd(), msgrcv(), pread(), pwri s [2002/07/16] threads/40671threads pthread_cancel doesn't remove thread from o [2004/07/13] threads/69020threads pthreads library leaks _gc_mutex o [2004/09/21] threads/71966threads Mlnet Core Dumped : Fatal error '_pq_inse o [2004/11/21] threads/74180threads KSE problem. Applications those riched ma o [2005/01/20] threads/76513threads libpthread is not working o [2005/02/01] threads/76938threads include/unistd.h: ttyname_r prototype mis o [2005/04/04] threads/79526threads A memory leak in pthread_rwlock_init() o [2005/04/13] threads/79887threads [patch] freopen() isn't thread-safe 13 problems total. From owner-freebsd-threads@FreeBSD.ORG Mon Apr 18 14:00:06 2005 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 77AF916A4CE; Mon, 18 Apr 2005 14:00:06 +0000 (GMT) Received: from mxsf03.cluster1.charter.net (mxsf03.cluster1.charter.net [209.225.28.203]) by mx1.FreeBSD.org (Postfix) with ESMTP id E360243D45; Mon, 18 Apr 2005 14:00:05 +0000 (GMT) (envelope-from archie@dellroad.org) Received: from mxip18.cluster1.charter.net (mxip18a.cluster1.charter.net [209.225.28.148])j3IE042J029623; Mon, 18 Apr 2005 10:00:04 -0400 Received: from cable-68-113-94-164.mtv.al.charter.com (HELO InterJet.dellroad.org) (68.113.94.164) by mxip18.cluster1.charter.net with ESMTP; 18 Apr 2005 10:00:04 -0400 X-Ironport-AV: i="3.92,109,1112587200"; d="scan'208"; a="1030276579:sNHT13626332" 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 IAA51536; Mon, 18 Apr 2005 08:56:37 -0500 (CDT) Received: from [127.0.0.1] (localhost [127.0.0.1])j3IDuaZK009956; Mon, 18 Apr 2005 08:56:36 -0500 (CDT) (envelope-from archie@dellroad.org) Message-ID: <4263BC94.9040308@dellroad.org> Date: Mon, 18 Apr 2005 08:56:36 -0500 From: Archie Cobbs User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Eischen References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: David Xu cc: freebsd-threads@freebsd.org Subject: Re: Bug with pthread_getspecific() and signals 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: Mon, 18 Apr 2005 14:00:06 -0000 Daniel Eischen wrote: >>Does POSIX say that pthread_getspecific can be used in signal handler ? > > I don't think using it in a signal handler should cause a problem > for our implementation though. Probably the real problem is that > the signal handler is not running in the expected thread. I'd > double check the signal masks and make sure there is only one > thread that could possibly handle the signal. This is a synchronous signal (SIGSEGV) and it's occurring in application code. So it should be delivered to the thread that caused it, right? That's what almost always happens. Also, the this occurs on the second SIGSEGV. When the first one is delivered, pthread_getspecific() and pthread_self() return the correct values. Other random notes: most of the time this bug doesn't happen. However with this particular application, it happens 100% of the time. Still working on a simple test case... if you want a large and complex test case I have that already... :-) -Archie __________________________________________________________________________ Archie Cobbs * CTO, Awarix * http://www.awarix.com From owner-freebsd-threads@FreeBSD.ORG Mon Apr 18 14:28:09 2005 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 6911216A4CE; Mon, 18 Apr 2005 14:28:09 +0000 (GMT) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id EEC3243D2F; Mon, 18 Apr 2005 14:28:08 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) j3IES7nI016206; Mon, 18 Apr 2005 10:28:07 -0400 (EDT) Date: Mon, 18 Apr 2005 10:28:07 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Archie Cobbs In-Reply-To: <4263BC94.9040308@dellroad.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) cc: David Xu cc: freebsd-threads@freebsd.org Subject: Re: Bug with pthread_getspecific() and signals X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Daniel Eischen List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2005 14:28:09 -0000 On Mon, 18 Apr 2005, Archie Cobbs wrote: > Daniel Eischen wrote: > >>Does POSIX say that pthread_getspecific can be used in signal handler ? > > > > I don't think using it in a signal handler should cause a problem > > for our implementation though. Probably the real problem is that > > the signal handler is not running in the expected thread. I'd > > double check the signal masks and make sure there is only one > > thread that could possibly handle the signal. > > This is a synchronous signal (SIGSEGV) and it's occurring in > application code. So it should be delivered to the thread that > caused it, right? That's what almost always happens. I don't think libc_r differentiates between synchronous and asynchronous signals. It'll look for threads in sigwait(), then sigsuspend(), then any thread with the signal unmasked. > Still working on a simple test case... if you want a large and complex > test case I have that already... :-) Try -stable or -current with libpthread and libthr. -- DE From owner-freebsd-threads@FreeBSD.ORG Mon Apr 18 15:02:11 2005 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 C8BB416A4CE; Mon, 18 Apr 2005 15:02:11 +0000 (GMT) Received: from mxsf38.cluster1.charter.net (mxsf38.cluster1.charter.net [209.225.28.165]) by mx1.FreeBSD.org (Postfix) with ESMTP id 259DC43D39; Mon, 18 Apr 2005 15:02:11 +0000 (GMT) (envelope-from archie@dellroad.org) Received: from mxip08.cluster1.charter.net (mxip08a.cluster1.charter.net [209.225.28.138])j3IF291M024609; Mon, 18 Apr 2005 11:02:09 -0400 Received: from cable-68-113-94-164.mtv.al.charter.com (HELO InterJet.dellroad.org) (68.113.94.164) by mxip08.cluster1.charter.net with ESMTP; 18 Apr 2005 11:00:08 -0400 X-Ironport-AV: i="3.92,110,1112587200"; d="scan'208"; a="863273741:sNHT20863552" 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 JAA52079; Mon, 18 Apr 2005 09:47:44 -0500 (CDT) Received: from [127.0.0.1] (localhost [127.0.0.1])j3IElhZK010376; Mon, 18 Apr 2005 09:47:44 -0500 (CDT) (envelope-from archie@dellroad.org) Message-ID: <4263C88F.4050007@dellroad.org> Date: Mon, 18 Apr 2005 09:47:43 -0500 From: Archie Cobbs User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Eischen References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: David Xu cc: freebsd-threads@freebsd.org Subject: Re: Bug with pthread_getspecific() and signals 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: Mon, 18 Apr 2005 15:02:11 -0000 Daniel Eischen wrote: > I don't think libc_r differentiates between synchronous > and asynchronous signals. It'll look for threads in > sigwait(), then sigsuspend(), then any thread with the > signal unmasked. Well that would certainly explain my problem. By the way, this application is a Java virtual machine, trying to use signals to detect null pointer dereferences (and divide by zero). How is one supposed to do this if synchronous signals are not delivered to the thread that generated them? It then becomes impossible to detect in which thread the signal occurred. Is this a bug in libc_r? Does POSIX not specify this "same thread" behavior for synchronous signals? If it does, can you show me in which FreeBSD releases the bug is fixed? If not, how do other applications implement this?? > Try -stable or -current with libpthread and libthr. Unfortunately I don't have easy access to either such machine. I've been told that the same problem occurs with libthr though. In any case, if the thread library is not always sending synchronous signals to the generating thread then no further research is necessary. Thanks, -Archie __________________________________________________________________________ Archie Cobbs * CTO, Awarix * http://www.awarix.com From owner-freebsd-threads@FreeBSD.ORG Mon Apr 18 17:56:27 2005 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 B64EB16A4CE; Mon, 18 Apr 2005 17:56:27 +0000 (GMT) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 256E443D46; Mon, 18 Apr 2005 17:56:27 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) j3IHuPAB029156; Mon, 18 Apr 2005 13:56:25 -0400 (EDT) Date: Mon, 18 Apr 2005 13:56:25 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Archie Cobbs In-Reply-To: <4263C88F.4050007@dellroad.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) cc: David Xu cc: freebsd-threads@freebsd.org Subject: Re: Bug with pthread_getspecific() and signals X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Daniel Eischen List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2005 17:56:27 -0000 On Mon, 18 Apr 2005, Archie Cobbs wrote: > Daniel Eischen wrote: > > I don't think libc_r differentiates between synchronous > > and asynchronous signals. It'll look for threads in > > sigwait(), then sigsuspend(), then any thread with the > > signal unmasked. > > Well that would certainly explain my problem. By the way, this application > is a Java virtual machine, trying to use signals to detect null pointer > dereferences (and divide by zero). How is one supposed to do this if > synchronous signals are not delivered to the thread that generated them? > It then becomes impossible to detect in which thread the signal occurred. > > Is this a bug in libc_r? Does POSIX not specify this "same thread" behavior > for synchronous signals? Yes, yes. > If it does, can you show me in which FreeBSD releases the bug is fixed? I don't know if it ever got fixed in libc_r. > If not, how do other applications implement this?? > > > Try -stable or -current with libpthread and libthr. > > Unfortunately I don't have easy access to either such machine. > I've been told that the same problem occurs with libthr though. It should work correctly in both libpthread and libthr. libc_r is not being maintained. -- DE From owner-freebsd-threads@FreeBSD.ORG Mon Apr 18 18:15:55 2005 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 4903316A4DD for ; Mon, 18 Apr 2005 18:15:55 +0000 (GMT) Received: from zixvpm01.stv.org (zixvpm01.stv.org [207.203.41.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id CF59343D1D for ; Mon, 18 Apr 2005 18:15:54 +0000 (GMT) (envelope-from archie@dellroad.org) Received: from zixvpm01.stv.org (ZixVPM [127.0.0.1]) by Outbound.stv.org (Proprietary) with ESMTP id A52F01301A9 for ; Mon, 18 Apr 2005 13:15:26 -0500 (CDT) Received: from STVAVAPPL1.BHMSTV (unknown [10.104.14.2]) by zixvpm01.stv.org (Proprietary) with SMTP id 662F3190004; Mon, 18 Apr 2005 13:15:25 -0500 (CDT) Received: from unknown(10.104.145.22) by STVAVAPPL1.BHMSTV via csmap id 40f5ed4a_b033_11d9_8eeb_00304811e8c8_1771; Mon, 18 Apr 2005 12:56:56 -0500 (CDT) Received: from [127.0.0.1] (localhost [127.0.0.1])j3IIFk5K000542; Mon, 18 Apr 2005 13:15:47 -0500 (CDT) (envelope-from archie@dellroad.org) Message-ID: <4263F952.1000106@dellroad.org> Date: Mon, 18 Apr 2005 13:15:46 -0500 From: Archie Cobbs User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Eischen References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: David Xu cc: freebsd-threads@freebsd.org Subject: Re: Bug with pthread_getspecific() and signals 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: Mon, 18 Apr 2005 18:15:55 -0000 Daniel Eischen wrote: >>If it does, can you show me in which FreeBSD releases the bug is fixed? > > I don't know if it ever got fixed in libc_r. > > ... > > It should work correctly in both libpthread and libthr. > libc_r is not being maintained. Thanks.. unfortunately I'm not familiar with the exact history of FreeBSD's thread libraries. Can you help me understand how to detect/workaround this problem in my configure script? E.g., I need to know: - In what versions of FreeBSD will "-pthread" result in a non-broken (with respect to this bug) thread library? - Of the earlier versions of FreeBSD, in which ones is there a viable workaround and what is it (e.g., "-lpthread" instead of "-pthread"?) This bug makes my application basically useless so it's critical to understand when and how I can work around it. I'd like to add logic to the configure script to determine either (a) to give up, or (b) what the appropriate linker flag is, given the version of FreeBSD. Thanks, -Archie __________________________________________________________________________ Archie Cobbs * CTO, Awarix * http://www.awarix.com From owner-freebsd-threads@FreeBSD.ORG Mon Apr 18 18:23:01 2005 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 C650316A4CE; Mon, 18 Apr 2005 18:23:01 +0000 (GMT) Received: from mail.ntplx.net (mail.ntplx.net [204.213.176.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 359D543D3F; Mon, 18 Apr 2005 18:23:01 +0000 (GMT) (envelope-from deischen@freebsd.org) Received: from sea.ntplx.net (sea.ntplx.net [204.213.176.11]) j3IIMxVU026439; Mon, 18 Apr 2005 14:22:59 -0400 (EDT) Date: Mon, 18 Apr 2005 14:22:59 -0400 (EDT) From: Daniel Eischen X-X-Sender: eischen@sea.ntplx.net To: Archie Cobbs In-Reply-To: <4263F952.1000106@dellroad.org> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by AMaViS and Clam AntiVirus (mail.ntplx.net) cc: David Xu cc: freebsd-threads@freebsd.org Subject: Re: Bug with pthread_getspecific() and signals X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Daniel Eischen List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 18 Apr 2005 18:23:01 -0000 On Mon, 18 Apr 2005, Archie Cobbs wrote: > Daniel Eischen wrote: > >>If it does, can you show me in which FreeBSD releases the bug is fixed? > > > > I don't know if it ever got fixed in libc_r. > > > > ... > > > > It should work correctly in both libpthread and libthr. > > libc_r is not being maintained. > > Thanks.. unfortunately I'm not familiar with the exact history of > FreeBSD's thread libraries. > > Can you help me understand how to detect/workaround this problem in my > configure script? > > E.g., I need to know: > > - In what versions of FreeBSD will "-pthread" result in a non-broken > (with respect to this bug) thread library? Probably when -pthread was switched to libpthread from libc_r. Search the CVS commit log for sys/sys/param.h (r1.178). > - Of the earlier versions of FreeBSD, in which ones is there a viable > workaround and what is it (e.g., "-lpthread" instead of "-pthread"?) Probably not until 5.3-Release where libpthread became the default. > This bug makes my application basically useless so it's critical to > understand when and how I can work around it. I'd like to add logic > to the configure script to determine either (a) to give up, or (b) > what the appropriate linker flag is, given the version of FreeBSD. -- DE From owner-freebsd-threads@FreeBSD.ORG Mon Apr 18 20:05:55 2005 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 3917516A4CE for ; Mon, 18 Apr 2005 20:05:55 +0000 (GMT) Received: from zixvpm01.stv.org (zixvpm01.stv.org [207.203.41.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id 874ED43D55 for ; Mon, 18 Apr 2005 20:05:54 +0000 (GMT) (envelope-from archie@dellroad.org) Received: from zixvpm01.stv.org (ZixVPM [127.0.0.1]) by Outbound.stv.org (Proprietary) with ESMTP id A3098130226 for ; Mon, 18 Apr 2005 15:05:25 -0500 (CDT) Received: from STVAVAPPL1.BHMSTV (unknown [10.104.14.2]) by zixvpm01.stv.org (Proprietary) with SMTP id 45610190002; Mon, 18 Apr 2005 15:05:25 -0500 (CDT) Received: from unknown(10.104.145.22) by STVAVAPPL1.BHMSTV via csmap id 94daa2ac_b042_11d9_9b7b_00304811e8c8_27158; Mon, 18 Apr 2005 14:46:39 -0500 (CDT) Received: from [127.0.0.1] (localhost [127.0.0.1])j3IK5S5K000668; Mon, 18 Apr 2005 15:05:30 -0500 (CDT) (envelope-from archie@dellroad.org) Message-ID: <42641308.3060900@dellroad.org> Date: Mon, 18 Apr 2005 15:05:28 -0500 From: Archie Cobbs User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.3) Gecko/20041129 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Eischen References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: David Xu cc: freebsd-threads@freebsd.org Subject: Re: Bug with pthread_getspecific() and signals 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: Mon, 18 Apr 2005 20:05:55 -0000 Daniel Eischen wrote: >>E.g., I need to know: >> >>- In what versions of FreeBSD will "-pthread" result in a non-broken >> (with respect to this bug) thread library? > > Probably when -pthread was switched to libpthread from libc_r. > Search the CVS commit log for sys/sys/param.h (r1.178). > >>- Of the earlier versions of FreeBSD, in which ones is there a viable >> workaround and what is it (e.g., "-lpthread" instead of "-pthread"?) > > Probably not until 5.3-Release where libpthread became the default. So perhaps the simplest thing to do is look for libpthread and always link "-lpthread"; otherwise, if libpthread is not found, bail out. Thanks, -Archie __________________________________________________________________________ Archie Cobbs * CTO, Awarix * http://www.awarix.com From owner-freebsd-threads@FreeBSD.ORG Fri Apr 22 08:10:26 2005 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 EE93916A4CF; Fri, 22 Apr 2005 08:10:26 +0000 (GMT) Received: from tts.orel.ru (tts.orel.ru [213.59.64.67]) by mx1.FreeBSD.org (Postfix) with ESMTP id CBB7643D3F; Fri, 22 Apr 2005 08:10:25 +0000 (GMT) (envelope-from bel@orel.ru) Received: from [192.168.99.99] (pf1.net.orel.ru [213.59.64.75]) by tts.orel.ru (8.13.1/8.13.1/bel) with ESMTP id j3M8ABVT023967; Fri, 22 Apr 2005 12:10:12 +0400 Message-ID: <4268B15E.3080607@orel.ru> Date: Fri, 22 Apr 2005 12:10:06 +0400 From: Andrew Belashov Organization: ORIS User-Agent: Mozilla Thunderbird 1.0.2 (X11/20050419) X-Accept-Language: en-us, en MIME-Version: 1.0 To: David Xu References: <20050401223744.GA6096@crodrigues.org> <4250F283.5020005@orel.ru> <42512B7D.3050700@freebsd.org> In-Reply-To: <42512B7D.3050700@freebsd.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Zombi-Check: on netra2.orel.ru cc: freebsd-threads@freebsd.org Subject: Re: New Nvidia drivers with KSE support 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: Fri, 22 Apr 2005 08:10:27 -0000 Hello! David Xu wrote: > Andrew Belashov wrote: > >> Hello! >> >> Craig Rodrigues wrote: >> >>> I just saw on http://bsdnews.com that Nvidia has new drivers >>> for FreeBSD 5.x, and these drivers supposedly support KSE: >>> >>> http://bsdnews.com/view_story.php3?story_id=4944 >>> >>> So is this one less reason to keep libc_r around in the tree? ;) >> >> >> >> libc_r is default for sparc64. >> libpthread (KSE) is broken for sparc64. >> libthr is unstable for sparc64. >> > Can you try newest libthr on sparc64 ? firefox-1.0.2,1 does not work with libthr on sparc64. Test enviroment: FreeBSD bel.localdomain 5.4-PRERELEASE FreeBSD 5.4-PRERELEASE #20: Mon Mar 21 14:22:25 MSK 2005 bel@bel.localdomain:/usr/obj/usr/src/sys/SUNC3D-SMP sparc64 Hardware: Sun Ultra 60 (2xUltraSparc-IIi@450MHz). -- With Best Regards, Andrew Belashov. From owner-freebsd-threads@FreeBSD.ORG Fri Apr 22 09:11:14 2005 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 B162816A51E for ; Fri, 22 Apr 2005 09:11:14 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8D70143D49; Fri, 22 Apr 2005 09:11:14 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from [127.0.0.1] (davidxu@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j3M9BB3r083636; Fri, 22 Apr 2005 09:11:13 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4268BFDF.7010308@freebsd.org> Date: Fri, 22 Apr 2005 17:11:59 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7.6) Gecko/20050319 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Andrew Belashov References: <20050401223744.GA6096@crodrigues.org> <4250F283.5020005@orel.ru> <42512B7D.3050700@freebsd.org> <4268B15E.3080607@orel.ru> In-Reply-To: <4268B15E.3080607@orel.ru> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit cc: freebsd-threads@freebsd.org Subject: Re: New Nvidia drivers with KSE support 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: Fri, 22 Apr 2005 09:11:14 -0000 Andrew Belashov wrote: > Hello! > > David Xu wrote: > >> Andrew Belashov wrote: >> >>> Hello! >>> >>> Craig Rodrigues wrote: >>> >>>> I just saw on http://bsdnews.com that Nvidia has new drivers >>>> for FreeBSD 5.x, and these drivers supposedly support KSE: >>>> >>>> http://bsdnews.com/view_story.php3?story_id=4944 >>>> >>>> So is this one less reason to keep libc_r around in the tree? ;) >>> >>> >>> >>> >>> libc_r is default for sparc64. >>> libpthread (KSE) is broken for sparc64. >>> libthr is unstable for sparc64. >>> >> Can you try newest libthr on sparc64 ? > > > firefox-1.0.2,1 does not work with libthr on sparc64. > > Test enviroment: > FreeBSD bel.localdomain 5.4-PRERELEASE FreeBSD 5.4-PRERELEASE #20: > Mon Mar 21 14:22:25 MSK 2005 > bel@bel.localdomain:/usr/obj/usr/src/sys/SUNC3D-SMP sparc64 > > Hardware: Sun Ultra 60 (2xUltraSparc-IIi@450MHz). > > -- > With Best Regards, > Andrew Belashov. > How about -CURRENT ? libthr in 5.4 is not the one in -CURRENT, they are too different. ; ) David Xu From owner-freebsd-threads@FreeBSD.ORG Fri Apr 22 15:02:07 2005 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 510B916A4CE for ; Fri, 22 Apr 2005 15:02:07 +0000 (GMT) Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1FE1943D48 for ; Fri, 22 Apr 2005 15:02:07 +0000 (GMT) (envelope-from rodrigc@crodrigues.org) Received: from h00609772adf0.ne.client2.attbi.com ([66.30.114.143]) by comcast.net (rwcrmhc12) with ESMTP id <2005042215020601400php5pe>; Fri, 22 Apr 2005 15:02:06 +0000 Received: from h00609772adf0.ne.client2.attbi.com (localhost.127.in-addr.arpa [127.0.0.1])j3MF2AGs033899; Fri, 22 Apr 2005 11:02:10 -0400 (EDT) (envelope-from rodrigc@h00609772adf0.ne.client2.attbi.com) Received: (from rodrigc@localhost)j3MF2Ata033898; Fri, 22 Apr 2005 11:02:10 -0400 (EDT) (envelope-from rodrigc) Date: Fri, 22 Apr 2005 11:02:09 -0400 From: Craig Rodrigues To: Archie Cobbs Message-ID: <20050422150209.GA33838@crodrigues.org> References: <42641308.3060900@dellroad.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <42641308.3060900@dellroad.org> User-Agent: Mutt/1.5.9i cc: freebsd-threads@freebsd.org Subject: Re: Bug with pthread_getspecific() and signals 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: Fri, 22 Apr 2005 15:02:07 -0000 On Mon, Apr 18, 2005 at 03:05:28PM -0500, Archie Cobbs wrote: > So perhaps the simplest thing to do is look for libpthread and always > link "-lpthread"; otherwise, if libpthread is not found, bail out. That's a reasonable approach. Alternatively, if you want, look at the devel/apr port (which I maintain). I had to put some logic in there in the configure scripts to link to the correct pthread library, depending if you are on 4.x or 5.x. Basically, what I have logic that does something like: os_version=`/sbin/sysctl -n kern.osreldate` # 502102 is when libc_r switched to libpthread (aka libkse). if test $os_version -ge "502102"; then apr_cv_pthreads_cflags="none" apr_cv_pthreads_lib="-lpthread" else APR_ADDTO(CPPFLAGS, [-D_THREAD_SAFE -D_REENTRANT]) apr_cv_pthreads_lib="-lc_r" APR_SETIFNULL(enable_threads, [no]) fi In my opinion, when libc_r is removed from the tree in -CURRENT, that will be good, because people still try to use it, and then get annoyed when they encounter problems with it. It can't disappear in the 4.x branch though.... -- Craig Rodrigues rodrigc@crodrigues.org