From owner-freebsd-threads@FreeBSD.ORG Mon Sep 6 11:07:06 2010 Return-Path: Delivered-To: freebsd-threads@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5751E10656BB for ; Mon, 6 Sep 2010 11:07:06 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 3B0CC8FC17 for ; Mon, 6 Sep 2010 11:07:06 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o86B76lO011921 for ; Mon, 6 Sep 2010 11:07:06 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o86B75OO011919 for freebsd-threads@FreeBSD.org; Mon, 6 Sep 2010 11:07:05 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 6 Sep 2010 11:07:05 GMT Message-Id: <201009061107.o86B75OO011919@freefall.freebsd.org> X-Authentication-Warning: freefall.freebsd.org: gnats set sender to owner-bugmaster@FreeBSD.org using -f From: FreeBSD bugmaster To: freebsd-threads@FreeBSD.org Cc: Subject: Current problem reports assigned to freebsd-threads@FreeBSD.org X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 11:07:06 -0000 Note: to view an individual PR, use: http://www.freebsd.org/cgi/query-pr.cgi?pr=(number). The following is a listing of current problems submitted by FreeBSD users. These represent problem reports covering all versions including experimental development code and obsolete releases. S Tracker Resp. Description -------------------------------------------------------------------------------- o threa/149366 threads pthread_cleanup_pop never runs the configured routine o threa/148515 threads Memory / syslog strangeness in FreeBSD 8.x ( possible o threa/141721 threads rtprio(1): (id|rt)prio priority resets when new thread o threa/136345 threads Recursive read rwlocks in thread A cause deadlock with o threa/135673 threads databases/mysql50-server - MySQL query lock-ups on 7.2 o threa/133734 threads 32 bit libthr failing pthread_create() o threa/128922 threads threads hang with xorg running o threa/127225 threads bug in lib/libthr/thread/thr_init.c o threa/122923 threads 'nice' does not prevent background process from steali o threa/121336 threads lang/neko threading ok on UP, broken on SMP (FreeBSD 7 o threa/116668 threads can no longer use jdk15 with libthr on -stable SMP o threa/116181 threads /dev/io-related io access permissions are not propagat o threa/115211 threads pthread_atfork misbehaves in initial thread o threa/110636 threads [request] gdb(1): using gdb with multi thread applicat o threa/110306 threads apache 2.0 segmentation violation when calling gethost o threa/103975 threads Implicit loading/unloading of libpthread.so may crash o threa/101323 threads [patch] fork(2) in threaded programs broken. s threa/100815 threads FBSD 5.5 broke nanosleep in libc_r s threa/94467 threads send(), sendto() and sendmsg() are not correct in libc s threa/84483 threads problems with devel/nspr and -lc_r on 4.x o threa/80992 threads abort() sometimes not caught by gdb depending on threa o threa/79887 threads [patch] freopen() isn't thread-safe o threa/79683 threads svctcp_create() fails if multiple threads call at the s threa/76694 threads fork cause hang in dup()/close() function in child (-l s threa/76690 threads fork hang in child for -lc_r s threa/69020 threads pthreads library leaks _gc_mutex s threa/49087 threads Signals lost in programs linked with libc_r s threa/48856 threads Setting SIGCHLD to SIG_IGN still leaves zombies under s threa/40671 threads pthread_cancel doesn't remove thread from condition qu s threa/39922 threads [threads] [patch] Threaded applications executed with s threa/37676 threads libc_r: msgsnd(), msgrcv(), pread(), pwrite() need wra s threa/34536 threads accept() blocks other threads s threa/32295 threads [libc_r] [patch] pthread(3) dont dequeue signals s threa/30464 threads pthread mutex attributes -- pshared s threa/24632 threads libc_r delicate deviation from libc in handling SIGCHL s threa/24472 threads libc_r does not honor SO_SNDTIMEO/SO_RCVTIMEO socket o 36 problems total. From owner-freebsd-threads@FreeBSD.ORG Mon Sep 6 22:00:42 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 61F3A10656C6; Mon, 6 Sep 2010 22:00:42 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id 2B50D8FC13; Mon, 6 Sep 2010 22:00:42 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 87C261DD659; Tue, 7 Sep 2010 00:00:41 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 6006417328; Tue, 7 Sep 2010 00:00:41 +0200 (CEST) Date: Tue, 7 Sep 2010 00:00:41 +0200 From: Jilles Tjoelker To: freebsd-threads@freebsd.org, David Xu Message-ID: <20100906220041.GA4729@stack.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) Cc: Subject: sigwait() cancellation point X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 22:00:42 -0000 Our sigwait() implementation may not be POSIX-compliant as it returns EINTR when it is interrupted by a caught signal. (Unfortunately I can only find this in SUSv4 in the Rationale, B.2.3 Error Numbers, Disallowing Return of the [EINTR] Error Code; the sigwait() page in XSH does not list an [EINTR] error condition, but does not prohibit one either like pthread_mutex_lock() and various others do.) However, libthr's wrapper for sigwait() relies on EINTR. To keep the possibility of changing this to be what POSIX intends, it would be nice to remove this dependency. One way is to include SIGCANCEL in the set of waited signals, but this requires two additional syscalls to mask/unmask SIGCANCEL. Another way is to use sigwaitinfo() in the wrapper, which is permitted to return [EINTR]. If [EINTR] is removed from the kernel sigwait(), looping on [EINTR] can then be implemented in the wrapper. Calling pthread_exit from the SIGCANCEL handler is not possible as this leaves the program in doubt about any signal consumed by sigwait(). -- Jilles Tjoelker From owner-freebsd-threads@FreeBSD.ORG Tue Sep 7 07:06:06 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8D4B10656B5 for ; Tue, 7 Sep 2010 07:06:06 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id D99798FC1D; Tue, 7 Sep 2010 07:06:06 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o87765Jo061856; Tue, 7 Sep 2010 07:06:06 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4C8654DE.702@freebsd.org> Date: Tue, 07 Sep 2010 15:06:06 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Jilles Tjoelker References: <20100906220041.GA4729@stack.nl> In-Reply-To: <20100906220041.GA4729@stack.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-threads@freebsd.org Subject: Re: sigwait() cancellation point X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 07:06:07 -0000 Jilles Tjoelker wrote: > Our sigwait() implementation may not be POSIX-compliant as it returns > EINTR when it is interrupted by a caught signal. (Unfortunately I can > only find this in SUSv4 in the Rationale, B.2.3 Error Numbers, > Disallowing Return of the [EINTR] Error Code; the sigwait() page in XSH > does not list an [EINTR] error condition, but does not prohibit one > either like pthread_mutex_lock() and various others do.) > > However, libthr's wrapper for sigwait() relies on EINTR. To keep > the possibility of changing this to be what POSIX intends, it would be > nice to remove this dependency. > > One way is to include SIGCANCEL in the set of waited signals, but this > requires two additional syscalls to mask/unmask SIGCANCEL. > > Another way is to use sigwaitinfo() in the wrapper, which is permitted > to return [EINTR]. If [EINTR] is removed from the kernel sigwait(), > looping on [EINTR] can then be implemented in the wrapper. > > Calling pthread_exit from the SIGCANCEL handler is not possible as this > leaves the program in doubt about any signal consumed by sigwait(). > A system call can not return EINTR is not flexible, I think why don't we fix it in libc and libthr, but let kernel returns EINTR? From owner-freebsd-threads@FreeBSD.ORG Tue Sep 7 09:38:07 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2507F10656C2 for ; Tue, 7 Sep 2010 09:38:07 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 159CB8FC0C; Tue, 7 Sep 2010 09:38:07 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o879c5IZ044048; Tue, 7 Sep 2010 09:38:06 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4C86787E.6070908@freebsd.org> Date: Tue, 07 Sep 2010 17:38:06 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Jilles Tjoelker References: <20100906220041.GA4729@stack.nl> In-Reply-To: <20100906220041.GA4729@stack.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-threads@freebsd.org Subject: Re: sigwait() cancellation point X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 09:38:07 -0000 Jilles Tjoelker wrote: > Our sigwait() implementation may not be POSIX-compliant as it returns > EINTR when it is interrupted by a caught signal. (Unfortunately I can > only find this in SUSv4 in the Rationale, B.2.3 Error Numbers, > Disallowing Return of the [EINTR] Error Code; the sigwait() page in XSH > does not list an [EINTR] error condition, but does not prohibit one > either like pthread_mutex_lock() and various others do.) > > However, libthr's wrapper for sigwait() relies on EINTR. To keep > the possibility of changing this to be what POSIX intends, it would be > nice to remove this dependency. > > One way is to include SIGCANCEL in the set of waited signals, but this > requires two additional syscalls to mask/unmask SIGCANCEL. > > Another way is to use sigwaitinfo() in the wrapper, which is permitted > to return [EINTR]. If [EINTR] is removed from the kernel sigwait(), > looping on [EINTR] can then be implemented in the wrapper. > > Calling pthread_exit from the SIGCANCEL handler is not possible as this > leaves the program in doubt about any signal consumed by sigwait(). > I have worked out a patch: http://people.freebsd.org/~davidxu/patch/sigwait.diff From owner-freebsd-threads@FreeBSD.ORG Tue Sep 7 09:42:55 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E016A10656CB; Tue, 7 Sep 2010 09:42:55 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 5DCF98FC0C; Tue, 7 Sep 2010 09:42:54 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o879gnDJ037240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Sep 2010 12:42:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o879gnuD052117; Tue, 7 Sep 2010 12:42:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o879gntI052108; Tue, 7 Sep 2010 12:42:49 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 7 Sep 2010 12:42:49 +0300 From: Kostik Belousov To: David Xu Message-ID: <20100907094249.GA2465@deviant.kiev.zoral.com.ua> References: <20100906220041.GA4729@stack.nl> <4C86787E.6070908@freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="EVF5PPMfhYS0aIcm" Content-Disposition: inline In-Reply-To: <4C86787E.6070908@freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-2.2 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_50, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-threads@freebsd.org Subject: Re: sigwait() cancellation point X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 09:42:56 -0000 --EVF5PPMfhYS0aIcm Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Sep 07, 2010 at 05:38:06PM +0000, David Xu wrote: > Jilles Tjoelker wrote: > >Our sigwait() implementation may not be POSIX-compliant as it returns > >EINTR when it is interrupted by a caught signal. (Unfortunately I can > >only find this in SUSv4 in the Rationale, B.2.3 Error Numbers, > >Disallowing Return of the [EINTR] Error Code; the sigwait() page in XSH > >does not list an [EINTR] error condition, but does not prohibit one > >either like pthread_mutex_lock() and various others do.) > > > >However, libthr's wrapper for sigwait() relies on EINTR. To keep > >the possibility of changing this to be what POSIX intends, it would be > >nice to remove this dependency. > > > >One way is to include SIGCANCEL in the set of waited signals, but this > >requires two additional syscalls to mask/unmask SIGCANCEL. > > > >Another way is to use sigwaitinfo() in the wrapper, which is permitted > >to return [EINTR]. If [EINTR] is removed from the kernel sigwait(), > >looping on [EINTR] can then be implemented in the wrapper. > > > >Calling pthread_exit from the SIGCANCEL handler is not possible as this > >leaves the program in doubt about any signal consumed by sigwait(). > > > I have worked out a patch: >=20 > http://people.freebsd.org/~davidxu/patch/sigwait.diff Isn't __sys_sigwait() supposed to return -1 and set errno ? --EVF5PPMfhYS0aIcm Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkyGCRkACgkQC3+MBN1Mb4h+OACg7hfjTQxIBo51l48MFze1jB53 togAoMLB2WBbXhiK3kze065He7fIGl05 =AZkA -----END PGP SIGNATURE----- --EVF5PPMfhYS0aIcm-- From owner-freebsd-threads@FreeBSD.ORG Tue Sep 7 09:46:20 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8703E10656F0 for ; Tue, 7 Sep 2010 09:46:20 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 5B3258FC1A; Tue, 7 Sep 2010 09:46:20 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o879kIor053434; Tue, 7 Sep 2010 09:46:19 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4C867A6B.8040408@freebsd.org> Date: Tue, 07 Sep 2010 17:46:19 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Kostik Belousov References: <20100906220041.GA4729@stack.nl> <4C86787E.6070908@freebsd.org> <20100907094249.GA2465@deviant.kiev.zoral.com.ua> In-Reply-To: <20100907094249.GA2465@deviant.kiev.zoral.com.ua> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-threads@freebsd.org Subject: Re: sigwait() cancellation point X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Sep 2010 09:46:20 -0000 Kostik Belousov wrote: > On Tue, Sep 07, 2010 at 05:38:06PM +0000, David Xu wrote: >> Jilles Tjoelker wrote: >>> Our sigwait() implementation may not be POSIX-compliant as it returns >>> EINTR when it is interrupted by a caught signal. (Unfortunately I can >>> only find this in SUSv4 in the Rationale, B.2.3 Error Numbers, >>> Disallowing Return of the [EINTR] Error Code; the sigwait() page in XSH >>> does not list an [EINTR] error condition, but does not prohibit one >>> either like pthread_mutex_lock() and various others do.) >>> >>> However, libthr's wrapper for sigwait() relies on EINTR. To keep >>> the possibility of changing this to be what POSIX intends, it would be >>> nice to remove this dependency. >>> >>> One way is to include SIGCANCEL in the set of waited signals, but this >>> requires two additional syscalls to mask/unmask SIGCANCEL. >>> >>> Another way is to use sigwaitinfo() in the wrapper, which is permitted >>> to return [EINTR]. If [EINTR] is removed from the kernel sigwait(), >>> looping on [EINTR] can then be implemented in the wrapper. >>> >>> Calling pthread_exit from the SIGCANCEL handler is not possible as this >>> leaves the program in doubt about any signal consumed by sigwait(). >>> >> I have worked out a patch: >> >> http://people.freebsd.org/~davidxu/patch/sigwait.diff > Isn't __sys_sigwait() supposed to return -1 and set errno ? No, it returns error code, and zero means success. From owner-freebsd-threads@FreeBSD.ORG Wed Sep 8 17:56:11 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3F9A71065672; Wed, 8 Sep 2010 17:56:11 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay02.stack.nl [IPv6:2001:610:1108:5010::104]) by mx1.freebsd.org (Postfix) with ESMTP id 065338FC12; Wed, 8 Sep 2010 17:56:11 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id DC8CE35A838; Wed, 8 Sep 2010 19:56:09 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id D0DBB17248; Wed, 8 Sep 2010 19:56:09 +0200 (CEST) Date: Wed, 8 Sep 2010 19:56:09 +0200 From: Jilles Tjoelker To: David Xu Message-ID: <20100908175609.GA30144@stack.nl> References: <20100906220041.GA4729@stack.nl> <4C86787E.6070908@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C86787E.6070908@freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-threads@freebsd.org Subject: Re: sigwait() cancellation point X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Sep 2010 17:56:11 -0000 On Tue, Sep 07, 2010 at 05:38:06PM +0000, David Xu wrote: > Jilles Tjoelker wrote: > > Our sigwait() implementation may not be POSIX-compliant as it returns > > EINTR when it is interrupted by a caught signal. (Unfortunately I can > > only find this in SUSv4 in the Rationale, B.2.3 Error Numbers, > > Disallowing Return of the [EINTR] Error Code; the sigwait() page in XSH > > does not list an [EINTR] error condition, but does not prohibit one > > either like pthread_mutex_lock() and various others do.) > A system call can not return EINTR is not flexible, I think why don't > we fix it in libc and libthr, but let kernel returns EINTR? > I have worked out a patch: > http://people.freebsd.org/~davidxu/patch/sigwait.diff The idea and patch seem sensible. Some man page changes seem in order though: sigwaitinfo.2 should mention this difference between sigwait() and sigwaitinfo() more explicitly. -- Jilles Tjoelker From owner-freebsd-threads@FreeBSD.ORG Thu Sep 9 06:29:28 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8455A10656BF for ; Thu, 9 Sep 2010 06:29:28 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 5A15A8FC19; Thu, 9 Sep 2010 06:29:28 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o896TQPI081896; Thu, 9 Sep 2010 06:29:27 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4C88EF47.4010906@freebsd.org> Date: Thu, 09 Sep 2010 14:29:27 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Jilles Tjoelker References: <20100906220041.GA4729@stack.nl> <4C86787E.6070908@freebsd.org> <20100908175609.GA30144@stack.nl> In-Reply-To: <20100908175609.GA30144@stack.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-threads@freebsd.org Subject: Re: sigwait() cancellation point X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 06:29:28 -0000 Jilles Tjoelker wrote: > On Tue, Sep 07, 2010 at 05:38:06PM +0000, David Xu wrote: >> Jilles Tjoelker wrote: >>> Our sigwait() implementation may not be POSIX-compliant as it returns >>> EINTR when it is interrupted by a caught signal. (Unfortunately I can >>> only find this in SUSv4 in the Rationale, B.2.3 Error Numbers, >>> Disallowing Return of the [EINTR] Error Code; the sigwait() page in XSH >>> does not list an [EINTR] error condition, but does not prohibit one >>> either like pthread_mutex_lock() and various others do.) > >> A system call can not return EINTR is not flexible, I think why don't >> we fix it in libc and libthr, but let kernel returns EINTR? > >> I have worked out a patch: > >> http://people.freebsd.org/~davidxu/patch/sigwait.diff > > The idea and patch seem sensible. Some man page changes seem in order > though: sigwaitinfo.2 should mention this difference between sigwait() > and sigwaitinfo() more explicitly. > problem is I still want to know which OS does not return EINTR ? it seems I can not find one on net, so is it an accident of the specification group? From owner-freebsd-threads@FreeBSD.ORG Thu Sep 9 22:55:25 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 26C8B106564A; Thu, 9 Sep 2010 22:55:25 +0000 (UTC) (envelope-from jilles@stack.nl) Received: from mx1.stack.nl (relay04.stack.nl [IPv6:2001:610:1108:5010::107]) by mx1.freebsd.org (Postfix) with ESMTP id DF1188FC19; Thu, 9 Sep 2010 22:55:24 +0000 (UTC) Received: from turtle.stack.nl (turtle.stack.nl [IPv6:2001:610:1108:5010::132]) by mx1.stack.nl (Postfix) with ESMTP id 3E4061DD648; Fri, 10 Sep 2010 00:55:24 +0200 (CEST) Received: by turtle.stack.nl (Postfix, from userid 1677) id 3303717248; Fri, 10 Sep 2010 00:55:24 +0200 (CEST) Date: Fri, 10 Sep 2010 00:55:24 +0200 From: Jilles Tjoelker To: David Xu Message-ID: <20100909225524.GC48144@stack.nl> References: <20100906220041.GA4729@stack.nl> <4C86787E.6070908@freebsd.org> <20100908175609.GA30144@stack.nl> <4C88EF47.4010906@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4C88EF47.4010906@freebsd.org> User-Agent: Mutt/1.5.20 (2009-06-14) Cc: freebsd-threads@freebsd.org Subject: Re: sigwait() cancellation point X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Sep 2010 22:55:25 -0000 On Thu, Sep 09, 2010 at 02:29:27PM +0000, David Xu wrote: > Jilles Tjoelker wrote: > > On Tue, Sep 07, 2010 at 05:38:06PM +0000, David Xu wrote: > >> Jilles Tjoelker wrote: > >>> Our sigwait() implementation may not be POSIX-compliant as it returns > >>> EINTR when it is interrupted by a caught signal. (Unfortunately I can > >>> only find this in SUSv4 in the Rationale, B.2.3 Error Numbers, > >>> Disallowing Return of the [EINTR] Error Code; the sigwait() page in XSH > >>> does not list an [EINTR] error condition, but does not prohibit one > >>> either like pthread_mutex_lock() and various others do.) > >> A system call can not return EINTR is not flexible, I think why don't > >> we fix it in libc and libthr, but let kernel returns EINTR? > >> I have worked out a patch: > >> http://people.freebsd.org/~davidxu/patch/sigwait.diff > > The idea and patch seem sensible. Some man page changes seem in order > > though: sigwaitinfo.2 should mention this difference between sigwait() > > and sigwaitinfo() more explicitly. > problem is I still want to know which OS does not return EINTR ? > it seems I can not find one on net, so is it an accident of the > specification group? Recent versions of glibc do this. They implement sigwait/sigwaitinfo/sigtimedwait based on a single extended sigtimedwait system call; sigwait differs from the others by retrying when it gets EINTR. This is not documented very well in man pages (for example, man sigwait might get you an ancient LinuxThreads man page). One reference: http://lkml.indiana.edu/hypermail/linux/kernel/0508.0/0181.html Google also provides various examples of applications that treated any sigwait() error as fatal and needed to be changed to work reliably on systems where sigwait() may return EINTR (not just FreeBSD). -- Jilles Tjoelker From owner-freebsd-threads@FreeBSD.ORG Fri Sep 10 01:57:34 2010 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F1341065673 for ; Fri, 10 Sep 2010 01:57:34 +0000 (UTC) (envelope-from davidxu@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 5D7768FC12; Fri, 10 Sep 2010 01:57:34 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o8A1vW6W033428; Fri, 10 Sep 2010 01:57:33 GMT (envelope-from davidxu@freebsd.org) Message-ID: <4C8A010D.6050805@freebsd.org> Date: Fri, 10 Sep 2010 09:57:33 +0000 From: David Xu User-Agent: Thunderbird 2.0.0.24 (X11/20100630) MIME-Version: 1.0 To: Jilles Tjoelker References: <20100906220041.GA4729@stack.nl> <4C86787E.6070908@freebsd.org> <20100908175609.GA30144@stack.nl> <4C88EF47.4010906@freebsd.org> <20100909225524.GC48144@stack.nl> In-Reply-To: <20100909225524.GC48144@stack.nl> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-threads@freebsd.org Subject: Re: sigwait() cancellation point X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Sep 2010 01:57:34 -0000 Jilles Tjoelker wrote: > Recent versions of glibc do this. They implement > sigwait/sigwaitinfo/sigtimedwait based on a single extended sigtimedwait > system call; sigwait differs from the others by retrying when it gets > EINTR. This is not documented very well in man pages (for example, man > sigwait might get you an ancient LinuxThreads man page). > > One reference: > http://lkml.indiana.edu/hypermail/linux/kernel/0508.0/0181.html > > Google also provides various examples of applications that treated any > sigwait() error as fatal and needed to be changed to work reliably on > systems where sigwait() may return EINTR (not just FreeBSD). > I have committed it, thanks!