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; }