From owner-freebsd-threads@FreeBSD.ORG Mon Mar 8 11:07:09 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 00746106564A for ; Mon, 8 Mar 2010 11:07:09 +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 E1D3F8FC17 for ; Mon, 8 Mar 2010 11:07:08 +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 o28B78RL073837 for ; Mon, 8 Mar 2010 11:07:08 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o28B770P073835 for freebsd-threads@FreeBSD.org; Mon, 8 Mar 2010 11:07:07 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 8 Mar 2010 11:07:07 GMT Message-Id: <201003081107.o28B770P073835@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, 08 Mar 2010 11:07:09 -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/143115 threads [patch] pthread_join() can return EOPNOTSUPP o threa/141721 threads rtprio(1): (id|rt)prio priority resets when new thread o threa/141198 threads [libc] src/lib/libc/stdio does not properly initialize 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 p threa/135462 threads [PATCH] _thread_cleanupspecific() doesn't handle delet 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/118715 threads kse problem 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/83914 threads [libc] popen() doesn't work in static threaded program o threa/80992 threads abort() sometimes not caught by gdb depending on threa o threa/80435 threads panic on high loads 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 o threa/75273 threads FBSD 5.3 libpthread (KSE) bug o threa/72953 threads fork() unblocks blocked signals w/o PTHREAD_SCOPE_SYST o threa/70975 threads [sysvipc] unexpected and unreliable behaviour when usi 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 43 problems total. From owner-freebsd-threads@FreeBSD.ORG Mon Mar 8 18:00:20 2010 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 27DDA1065674 for ; Mon, 8 Mar 2010 18:00:20 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 04A8B8FC15 for ; Mon, 8 Mar 2010 18:00:20 +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 o28I0HtY030051 for ; Mon, 8 Mar 2010 18:00:17 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o28I0Hh7030050; Mon, 8 Mar 2010 18:00:17 GMT (envelope-from gnats) Resent-Date: Mon, 8 Mar 2010 18:00:17 GMT Resent-Message-Id: <201003081800.o28I0Hh7030050@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-threads@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Sam Robb Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA201106566B for ; Mon, 8 Mar 2010 17:51:39 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21]) by mx1.freebsd.org (Postfix) with ESMTP id B8A4B8FC1B for ; Mon, 8 Mar 2010 17:51:39 +0000 (UTC) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o28Hpd3H016823 for ; Mon, 8 Mar 2010 17:51:39 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id o28HpdCg016822; Mon, 8 Mar 2010 17:51:39 GMT (envelope-from nobody) Message-Id: <201003081751.o28HpdCg016822@www.freebsd.org> Date: Mon, 8 Mar 2010 17:51:39 GMT From: Sam Robb To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: threads/144558: Repeated calls to __rpc_createerr allocates multiple thread-specific data slots 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, 08 Mar 2010 18:00:20 -0000 >Number: 144558 >Category: threads >Synopsis: Repeated calls to __rpc_createerr allocates multiple thread-specific data slots >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Mar 08 18:00:16 UTC 2010 >Closed-Date: >Last-Modified: >Originator: Sam Robb >Release: 7.1 >Organization: Avere Systems >Environment: FreeBSD build1.arriad.com 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 08:58:24 UTC 2009 root@driscoll.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: On the first call to __rpc_createerr() in a thread, the function attempts to allocate a thread-specific slot to hold the rpc error data. Subsequent calls from the same thread continue to allocate new thread-specific slots without freeing the first, so that repeated calls eventually result in all available thread-specific data slots being allocated. >How-To-Repeat: >Fix: Patch attached Patch attached with submission follows: --- a/src/lib/libc/rpc/mt_misc.c +++ b/src/lib/libc/rpc/mt_misc.c @@ -89,15 +89,16 @@ struct rpc_createerr rpc_createerr; struct rpc_createerr * __rpc_createerr() { - static thread_key_t rce_key = 0; + static thread_key_t rce_key = -1; struct rpc_createerr *rce_addr = 0; if (thr_main()) return (&rpc_createerr); if ((rce_addr = - (struct rpc_createerr *)thr_getspecific(rce_key)) != 0) { + (struct rpc_createerr *)thr_getspecific(rce_key)) == 0) { mutex_lock(&tsd_lock); - if (thr_keycreate(&rce_key, free) != 0) { + if ((rce_key == -1) && + (thr_keycreate(&rce_key, free) != 0)) { mutex_unlock(&tsd_lock); return (&rpc_createerr); } >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-threads@FreeBSD.ORG Mon Mar 8 19:00:20 2010 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 604291065679 for ; Mon, 8 Mar 2010 19:00:20 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 4CB0D8FCCF for ; Mon, 8 Mar 2010 19:00:17 +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 o28J0HE4081058 for ; Mon, 8 Mar 2010 19:00:17 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o28J0H6n081057; Mon, 8 Mar 2010 19:00:17 GMT (envelope-from gnats) Date: Mon, 8 Mar 2010 19:00:17 GMT Message-Id: <201003081900.o28J0H6n081057@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: Sam Robb Cc: Subject: Re: threads/144558: Repeated calls to __rpc_createerr allocates multiple thread-specific data slots X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Sam Robb List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Mar 2010 19:00:20 -0000 The following reply was made to PR threads/144558; it has been noted by GNATS. From: Sam Robb To: bug-followup@FreeBSD.org, Sam Robb Cc: Subject: Re: threads/144558: Repeated calls to __rpc_createerr allocates multiple thread-specific data slots Date: Mon, 8 Mar 2010 13:36:16 -0500 Example program that shows repeated allocation of thread-specific data = slots caused by calling clnt_pcreateerror() from a thread. #include #include #include #include #include #include #include void * rce_test(void * arg) { struct sockaddr_in addr; int i =3D 0; pthread_key_t thr_key_start =3D -1; pthread_key_t thr_key_end =3D -1; int * pdata =3D malloc(sizeof(int)); pthread_key_create(&thr_key_start, pdata); printf("thr_key_start =3D %d\n", thr_key_start); for (i =3D 0; i <=3D 25 ; i++) { CLIENT * client =3D NULL; char buf[256]; pthread_key_t thr_key_intermediate =3D -1; sprintf(buf, "Call #%d", i); client =3D clnt_create("127.0.0.2", REXPROG, REXVERS, = "udp"); clnt_pcreateerror(buf); pthread_key_create(&thr_key_intermediate, pdata); printf("thr_key_intermediate =3D %d\n", = thr_key_intermediate); if (client) { clnt_destroy(client); } } pthread_key_create(&thr_key_end, pdata); printf("thr_key_end =3D %d\n", thr_key_end); return pdata; } int main(int argc, char** argv) { pthread_t thread; void *result; pthread_attr_t attr =3D 0; int res =3D 0; res =3D pthread_create(&thread, &attr, rce_test, NULL); assert(res =3D=3D 0); res =3D pthread_join(thread, &result); assert(res =3D=3D 0); return 0; } From owner-freebsd-threads@FreeBSD.ORG Tue Mar 9 15:11:02 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 212561065678; Tue, 9 Mar 2010 15:11:02 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id E85788FC16; Tue, 9 Mar 2010 15:11:01 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 8B86646B51; Tue, 9 Mar 2010 10:11:01 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id 7214E8A01F; Tue, 9 Mar 2010 10:11:00 -0500 (EST) From: John Baldwin To: freebsd-threads@freebsd.org Date: Tue, 9 Mar 2010 10:11:00 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; ) References: <201003081751.o28HpdCg016822@www.freebsd.org> In-Reply-To: <201003081751.o28HpdCg016822@www.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201003091011.00097.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Tue, 09 Mar 2010 10:11:00 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Sam Robb , freebsd-gnats-submit@freebsd.org Subject: Re: threads/144558: Repeated calls to __rpc_createerr allocates multiple thread-specific data slots 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, 09 Mar 2010 15:11:02 -0000 On Monday 08 March 2010 12:51:39 pm Sam Robb wrote: > > >Number: 144558 > >Category: threads > >Synopsis: Repeated calls to __rpc_createerr allocates multiple thread-specific data slots > >Confidential: no > >Severity: serious > >Priority: medium > >Responsible: freebsd-threads > >State: open > >Quarter: > >Keywords: > >Date-Required: > >Class: sw-bug > >Submitter-Id: current-users > >Arrival-Date: Mon Mar 08 18:00:16 UTC 2010 > >Closed-Date: > >Last-Modified: > >Originator: Sam Robb > >Release: 7.1 > >Organization: > Avere Systems > >Environment: > FreeBSD build1.arriad.com 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 08:58:24 UTC 2009 root@driscoll.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 > >Description: > On the first call to __rpc_createerr() in a thread, the function attempts to allocate a thread-specific slot to hold the rpc error data. Subsequent calls from the same thread continue to allocate new thread-specific slots without freeing the first, so that repeated calls eventually result in all available thread-specific data slots being allocated. Can you try this patch instead? It changes the RPC code in libc to use pthread_once() to execute init functions that create various pthread keys used for per-thread data. http://www.FreeBSD.org/~jhb/patches/rpc_once.patch -- John Baldwin From owner-freebsd-threads@FreeBSD.ORG Tue Mar 9 15:20:04 2010 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9CB781065678 for ; Tue, 9 Mar 2010 15:20:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 8D2338FC29 for ; Tue, 9 Mar 2010 15:20:04 +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 o29FK4GO065138 for ; Tue, 9 Mar 2010 15:20:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o29FK4WC065136; Tue, 9 Mar 2010 15:20:04 GMT (envelope-from gnats) Date: Tue, 9 Mar 2010 15:20:04 GMT Message-Id: <201003091520.o29FK4WC065136@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: John Baldwin Cc: Subject: Re: threads/144558: Repeated calls to __rpc_createerr allocates multiple thread-specific data slots X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: John Baldwin List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2010 15:20:04 -0000 The following reply was made to PR threads/144558; it has been noted by GNATS. From: John Baldwin To: freebsd-threads@freebsd.org Cc: Sam Robb , freebsd-gnats-submit@freebsd.org Subject: Re: threads/144558: Repeated calls to __rpc_createerr allocates multiple thread-specific data slots Date: Tue, 9 Mar 2010 10:11:00 -0500 On Monday 08 March 2010 12:51:39 pm Sam Robb wrote: > > >Number: 144558 > >Category: threads > >Synopsis: Repeated calls to __rpc_createerr allocates multiple thread-specific data slots > >Confidential: no > >Severity: serious > >Priority: medium > >Responsible: freebsd-threads > >State: open > >Quarter: > >Keywords: > >Date-Required: > >Class: sw-bug > >Submitter-Id: current-users > >Arrival-Date: Mon Mar 08 18:00:16 UTC 2010 > >Closed-Date: > >Last-Modified: > >Originator: Sam Robb > >Release: 7.1 > >Organization: > Avere Systems > >Environment: > FreeBSD build1.arriad.com 7.1-RELEASE FreeBSD 7.1-RELEASE #0: Thu Jan 1 08:58:24 UTC 2009 root@driscoll.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 > >Description: > On the first call to __rpc_createerr() in a thread, the function attempts to allocate a thread-specific slot to hold the rpc error data. Subsequent calls from the same thread continue to allocate new thread-specific slots without freeing the first, so that repeated calls eventually result in all available thread-specific data slots being allocated. Can you try this patch instead? It changes the RPC code in libc to use pthread_once() to execute init functions that create various pthread keys used for per-thread data. http://www.FreeBSD.org/~jhb/patches/rpc_once.patch -- John Baldwin From owner-freebsd-threads@FreeBSD.ORG Tue Mar 9 18:10:06 2010 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E6085106564A for ; Tue, 9 Mar 2010 18:10:06 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id BB2FC8FC0A for ; Tue, 9 Mar 2010 18:10: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 o29IA5xv010190 for ; Tue, 9 Mar 2010 18:10:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o29IA5np010184; Tue, 9 Mar 2010 18:10:05 GMT (envelope-from gnats) Date: Tue, 9 Mar 2010 18:10:05 GMT Message-Id: <201003091810.o29IA5np010184@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: Sam Robb Cc: Subject: Re: threads/144558: [libc] [patch] Repeated calls to __rpc_createerr allocates multiple thread-specific data slots X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Sam Robb List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Mar 2010 18:10:07 -0000 The following reply was made to PR threads/144558; it has been noted by GNATS. From: Sam Robb To: bug-followup@FreeBSD.org, samrobb@averesystems.com Cc: Subject: Re: threads/144558: [libc] [patch] Repeated calls to __rpc_createerr allocates multiple thread-specific data slots Date: Tue, 9 Mar 2010 13:04:31 -0500 Looks good. One note - your version of rpc/getnetconfig.c was newer = than the stock 7.1 source. It was easy enough to apply the patch by = hand, though. -Samrobb=20= From owner-freebsd-threads@FreeBSD.ORG Wed Mar 10 13:24:16 2010 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E99E41065670; Wed, 10 Mar 2010 13:24:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id DA1308FC13; Wed, 10 Mar 2010 13:24:16 +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 o2ADOGGo045352; Wed, 10 Mar 2010 13:24:16 GMT (envelope-from jhb@freefall.freebsd.org) Received: (from jhb@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o2ADOGCZ045348; Wed, 10 Mar 2010 13:24:16 GMT (envelope-from jhb) Date: Wed, 10 Mar 2010 13:24:16 GMT Message-Id: <201003101324.o2ADOGCZ045348@freefall.freebsd.org> To: samrobb@averesystems.com, jhb@FreeBSD.org, freebsd-threads@FreeBSD.org, jhb@FreeBSD.org From: jhb@FreeBSD.org Cc: Subject: Re: threads/144558: [libc] [patch] Repeated calls to __rpc_createerr allocates multiple thread-specific data slots 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, 10 Mar 2010 13:24:17 -0000 Synopsis: [libc] [patch] Repeated calls to __rpc_createerr allocates multiple thread-specific data slots State-Changed-From-To: open->patched State-Changed-By: jhb State-Changed-When: Wed Mar 10 13:23:42 UTC 2010 State-Changed-Why: Fix has been committed to HEAD. I will merge it to 7.x and 8.x in about a week or so. It is too late to make it into 7.3, however. Responsible-Changed-From-To: freebsd-threads->jhb Responsible-Changed-By: jhb Responsible-Changed-When: Wed Mar 10 13:23:42 UTC 2010 Responsible-Changed-Why: Fix has been committed to HEAD. I will merge it to 7.x and 8.x in about a week or so. It is too late to make it into 7.3, however. http://www.freebsd.org/cgi/query-pr.cgi?pr=144558 From owner-freebsd-threads@FreeBSD.ORG Wed Mar 10 13:49:35 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 DBE851065672 for ; Wed, 10 Mar 2010 13:49:35 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id AF0108FC1A for ; Wed, 10 Mar 2010 13:49:35 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id 669B146B1A; Wed, 10 Mar 2010 08:49:35 -0500 (EST) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPA id A4AD38A021; Wed, 10 Mar 2010 08:49:34 -0500 (EST) From: John Baldwin To: freebsd-threads@freebsd.org, Sam Robb Date: Wed, 10 Mar 2010 08:19:33 -0500 User-Agent: KMail/1.12.1 (FreeBSD/7.3-CBSD-20100217; KDE/4.3.1; amd64; ; ) References: <201003091810.o29IA5np010184@freefall.freebsd.org> In-Reply-To: <201003091810.o29IA5np010184@freefall.freebsd.org> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201003100819.33518.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.0.1 (bigwig.baldwin.cx); Wed, 10 Mar 2010 08:49:34 -0500 (EST) X-Virus-Scanned: clamav-milter 0.95.1 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.6 required=4.2 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on bigwig.baldwin.cx Cc: Subject: Re: threads/144558: [libc] [patch] Repeated calls to __rpc_createerr allocates multiple thread-specific data slots 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, 10 Mar 2010 13:49:35 -0000 On Tuesday 09 March 2010 1:10:05 pm Sam Robb wrote: > The following reply was made to PR threads/144558; it has been noted by GNATS. > > From: Sam Robb > To: bug-followup@FreeBSD.org, > samrobb@averesystems.com > Cc: > Subject: Re: threads/144558: [libc] [patch] Repeated calls to __rpc_createerr allocates multiple thread-specific data slots > Date: Tue, 9 Mar 2010 13:04:31 -0500 > > Looks good. One note - your version of rpc/getnetconfig.c was newer = > than the stock 7.1 source. It was easy enough to apply the patch by = > hand, though. Oh, yes, it was against HEAD, sorry. -- John Baldwin From owner-freebsd-threads@FreeBSD.ORG Thu Mar 11 17:10:03 2010 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15DC4106566C for ; Thu, 11 Mar 2010 17:10:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id DD25A8FC2C for ; Thu, 11 Mar 2010 17:10:02 +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 o2BHA2Hf008789 for ; Thu, 11 Mar 2010 17:10:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o2BHA2eJ008788; Thu, 11 Mar 2010 17:10:02 GMT (envelope-from gnats) Date: Thu, 11 Mar 2010 17:10:02 GMT Message-Id: <201003111710.o2BHA2eJ008788@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: dfilter@FreeBSD.ORG (dfilter service) Cc: Subject: Re: threads/141198: commit references a PR X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: dfilter service List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2010 17:10:03 -0000 The following reply was made to PR threads/141198; it has been noted by GNATS. From: dfilter@FreeBSD.ORG (dfilter service) To: bug-followup@FreeBSD.org Cc: Subject: Re: threads/141198: commit references a PR Date: Thu, 11 Mar 2010 17:03:47 +0000 (UTC) Author: jhb Date: Thu Mar 11 17:03:32 2010 New Revision: 205021 URL: http://svn.freebsd.org/changeset/base/205021 Log: - Use an initializer macro to initialize fields in 'fake' FILE objects used by *sprintf(), etc. - Explicitly initialize _fl_mutex to PTHREAD_MUTEX_INITIALIZER for all FILE objects. This is currently a nop on FreeBSD, but is import for other platforms (or in the future) where PTHREAD_MUTEX_INITIALIZER is not simply zero. PR: threads/141198 Reported by: Jeremy Huddleston @ Apple MFC after: 2 weeks Modified: head/lib/libc/stdio/findfp.c head/lib/libc/stdio/local.h head/lib/libc/stdio/snprintf.c head/lib/libc/stdio/vasprintf.c head/lib/libc/stdio/vdprintf.c head/lib/libc/stdio/vfprintf.c head/lib/libc/stdio/vsnprintf.c head/lib/libc/stdio/vsprintf.c head/lib/libc/stdio/vsscanf.c head/lib/libc/stdio/vswprintf.c head/lib/libc/stdio/vswscanf.c head/lib/libc/stdio/xprintf.c Modified: head/lib/libc/stdio/findfp.c ============================================================================== --- head/lib/libc/stdio/findfp.c Thu Mar 11 16:58:15 2010 (r205020) +++ head/lib/libc/stdio/findfp.c Thu Mar 11 17:03:32 2010 (r205021) @@ -61,6 +61,7 @@ int __sdidinit; ._read = __sread, \ ._seek = __sseek, \ ._write = __swrite, \ + ._fl_mutex = PTHREAD_MUTEX_INITIALIZER, \ } /* the usual - (stdin + stdout + stderr) */ static FILE usual[FOPEN_MAX - 3]; @@ -96,7 +97,7 @@ moreglue(n) int n; { struct glue *g; - static FILE empty; + static FILE empty = { ._fl_mutex = PTHREAD_MUTEX_INITIALIZER }; FILE *p; g = (struct glue *)malloc(sizeof(*g) + ALIGNBYTES + n * sizeof(FILE)); @@ -154,7 +155,7 @@ found: fp->_ub._size = 0; fp->_lb._base = NULL; /* no line buffer */ fp->_lb._size = 0; -/* fp->_lock = NULL; */ /* once set always set (reused) */ +/* fp->_fl_mutex = NULL; */ /* once set always set (reused) */ fp->_orientation = 0; memset(&fp->_mbstate, 0, sizeof(mbstate_t)); return (fp); Modified: head/lib/libc/stdio/local.h ============================================================================== --- head/lib/libc/stdio/local.h Thu Mar 11 16:58:15 2010 (r205020) +++ head/lib/libc/stdio/local.h Thu Mar 11 17:03:32 2010 (r205021) @@ -110,6 +110,14 @@ extern int __sdidinit; } /* + * Structure initializations for 'fake' FILE objects. + */ +#define FAKE_FILE { \ + ._file = -1, \ + ._fl_mutex = PTHREAD_MUTEX_INITIALIZER, \ +} + +/* * Set the orientation for a stream. If o > 0, the stream has wide- * orientation. If o < 0, the stream has byte-orientation. */ Modified: head/lib/libc/stdio/snprintf.c ============================================================================== --- head/lib/libc/stdio/snprintf.c Thu Mar 11 16:58:15 2010 (r205020) +++ head/lib/libc/stdio/snprintf.c Thu Mar 11 17:03:32 2010 (r205021) @@ -48,7 +48,7 @@ snprintf(char * __restrict str, size_t n size_t on; int ret; va_list ap; - FILE f; + FILE f = FAKE_FILE; on = n; if (n != 0) @@ -56,12 +56,9 @@ snprintf(char * __restrict str, size_t n if (n > INT_MAX) n = INT_MAX; va_start(ap, fmt); - f._file = -1; f._flags = __SWR | __SSTR; f._bf._base = f._p = (unsigned char *)str; f._bf._size = f._w = n; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); ret = __vfprintf(&f, fmt, ap); if (on > 0) *f._p = '\0'; Modified: head/lib/libc/stdio/vasprintf.c ============================================================================== --- head/lib/libc/stdio/vasprintf.c Thu Mar 11 16:58:15 2010 (r205020) +++ head/lib/libc/stdio/vasprintf.c Thu Mar 11 17:03:32 2010 (r205021) @@ -42,9 +42,8 @@ vasprintf(str, fmt, ap) __va_list ap; { int ret; - FILE f; + FILE f = FAKE_FILE; - f._file = -1; f._flags = __SWR | __SSTR | __SALC; f._bf._base = f._p = (unsigned char *)malloc(128); if (f._bf._base == NULL) { @@ -53,8 +52,6 @@ vasprintf(str, fmt, ap) return (-1); } f._bf._size = f._w = 127; /* Leave room for the NUL */ - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); ret = __vfprintf(&f, fmt, ap); if (ret < 0) { free(f._bf._base); Modified: head/lib/libc/stdio/vdprintf.c ============================================================================== --- head/lib/libc/stdio/vdprintf.c Thu Mar 11 16:58:15 2010 (r205020) +++ head/lib/libc/stdio/vdprintf.c Thu Mar 11 17:03:32 2010 (r205021) @@ -39,7 +39,7 @@ __FBSDID("$FreeBSD$"); int vdprintf(int fd, const char * __restrict fmt, va_list ap) { - FILE f; + FILE f = FAKE_FILE; unsigned char buf[BUFSIZ]; int ret; @@ -56,8 +56,6 @@ vdprintf(int fd, const char * __restrict f._write = __swrite; f._bf._base = buf; f._bf._size = sizeof(buf); - f._orientation = 0; - bzero(&f._mbstate, sizeof(f._mbstate)); if ((ret = __vfprintf(&f, fmt, ap)) < 0) return (ret); Modified: head/lib/libc/stdio/vfprintf.c ============================================================================== --- head/lib/libc/stdio/vfprintf.c Thu Mar 11 16:58:15 2010 (r205020) +++ head/lib/libc/stdio/vfprintf.c Thu Mar 11 17:03:32 2010 (r205021) @@ -169,7 +169,7 @@ static int __sbprintf(FILE *fp, const char *fmt, va_list ap) { int ret; - FILE fake; + FILE fake = FAKE_FILE; unsigned char buf[BUFSIZ]; /* XXX This is probably not needed. */ Modified: head/lib/libc/stdio/vsnprintf.c ============================================================================== --- head/lib/libc/stdio/vsnprintf.c Thu Mar 11 16:58:15 2010 (r205020) +++ head/lib/libc/stdio/vsnprintf.c Thu Mar 11 17:03:32 2010 (r205021) @@ -47,7 +47,7 @@ vsnprintf(char * __restrict str, size_t size_t on; int ret; char dummy[2]; - FILE f; + FILE f = FAKE_FILE; on = n; if (n != 0) @@ -61,12 +61,9 @@ vsnprintf(char * __restrict str, size_t str = dummy; n = 1; } - f._file = -1; f._flags = __SWR | __SSTR; f._bf._base = f._p = (unsigned char *)str; f._bf._size = f._w = n; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); ret = __vfprintf(&f, fmt, ap); if (on > 0) *f._p = '\0'; Modified: head/lib/libc/stdio/vsprintf.c ============================================================================== --- head/lib/libc/stdio/vsprintf.c Thu Mar 11 16:58:15 2010 (r205020) +++ head/lib/libc/stdio/vsprintf.c Thu Mar 11 17:03:32 2010 (r205021) @@ -44,14 +44,11 @@ int vsprintf(char * __restrict str, const char * __restrict fmt, __va_list ap) { int ret; - FILE f; + FILE f = FAKE_FILE; - f._file = -1; f._flags = __SWR | __SSTR; f._bf._base = f._p = (unsigned char *)str; f._bf._size = f._w = INT_MAX; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); ret = __vfprintf(&f, fmt, ap); *f._p = 0; return (ret); Modified: head/lib/libc/stdio/vsscanf.c ============================================================================== --- head/lib/libc/stdio/vsscanf.c Thu Mar 11 16:58:15 2010 (r205020) +++ head/lib/libc/stdio/vsscanf.c Thu Mar 11 17:03:32 2010 (r205021) @@ -55,16 +55,11 @@ int vsscanf(const char * __restrict str, const char * __restrict fmt, __va_list ap) { - FILE f; + FILE f = FAKE_FILE; - f._file = -1; f._flags = __SRD; f._bf._base = f._p = (unsigned char *)str; f._bf._size = f._r = strlen(str); f._read = eofread; - f._ub._base = NULL; - f._lb._base = NULL; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); return (__svfscanf(&f, fmt, ap)); } Modified: head/lib/libc/stdio/vswprintf.c ============================================================================== --- head/lib/libc/stdio/vswprintf.c Thu Mar 11 16:58:15 2010 (r205020) +++ head/lib/libc/stdio/vswprintf.c Thu Mar 11 17:03:32 2010 (r205021) @@ -45,7 +45,7 @@ vswprintf(wchar_t * __restrict s, size_t { static const mbstate_t initial; mbstate_t mbs; - FILE f; + FILE f = FAKE_FILE; char *mbp; int ret, sverrno; size_t nwc; @@ -55,7 +55,6 @@ vswprintf(wchar_t * __restrict s, size_t return (-1); } - f._file = -1; f._flags = __SWR | __SSTR | __SALC; f._bf._base = f._p = (unsigned char *)malloc(128); if (f._bf._base == NULL) { @@ -63,8 +62,6 @@ vswprintf(wchar_t * __restrict s, size_t return (-1); } f._bf._size = f._w = 127; /* Leave room for the NUL */ - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); ret = __vfwprintf(&f, fmt, ap); if (ret < 0) { sverrno = errno; Modified: head/lib/libc/stdio/vswscanf.c ============================================================================== --- head/lib/libc/stdio/vswscanf.c Thu Mar 11 16:58:15 2010 (r205020) +++ head/lib/libc/stdio/vswscanf.c Thu Mar 11 17:03:32 2010 (r205021) @@ -62,7 +62,7 @@ vswscanf(const wchar_t * __restrict str, { static const mbstate_t initial; mbstate_t mbs; - FILE f; + FILE f = FAKE_FILE; char *mbstr; size_t mlen; int r; @@ -80,15 +80,10 @@ vswscanf(const wchar_t * __restrict str, free(mbstr); return (EOF); } - f._file = -1; f._flags = __SRD; f._bf._base = f._p = (unsigned char *)mbstr; f._bf._size = f._r = mlen; f._read = eofread; - f._ub._base = NULL; - f._lb._base = NULL; - f._orientation = 0; - memset(&f._mbstate, 0, sizeof(mbstate_t)); r = __vfwscanf(&f, fmt, ap); free(mbstr); Modified: head/lib/libc/stdio/xprintf.c ============================================================================== --- head/lib/libc/stdio/xprintf.c Thu Mar 11 16:58:15 2010 (r205020) +++ head/lib/libc/stdio/xprintf.c Thu Mar 11 17:03:32 2010 (r205021) @@ -48,6 +48,7 @@ #include #include "un-namespace.h" +#include "local.h" #include "printf.h" #include "fvwrite.h" @@ -575,7 +576,7 @@ static int __v3printf(FILE *fp, const char *fmt, int pct, va_list ap) { int ret; - FILE fake; + FILE fake = FAKE_FILE; unsigned char buf[BUFSIZ]; /* copy the important variables */ _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"