From owner-freebsd-threads@FreeBSD.ORG Sun Mar 2 17:18:49 2008 Return-Path: Delivered-To: threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9155D106566B for ; Sun, 2 Mar 2008 17:18:49 +0000 (UTC) (envelope-from jhein@timing.com) Received: from Daffy.timing.com (mx2.timing.com [206.168.13.218]) by mx1.freebsd.org (Postfix) with ESMTP id 520D08FC18 for ; Sun, 2 Mar 2008 17:18:49 +0000 (UTC) (envelope-from jhein@timing.com) Received: from gromit.timing.com (gromit.timing.com [206.168.13.209]) by Daffy.timing.com (8.13.1/8.13.1) with ESMTP id m22Gcr5u075937 for ; Sun, 2 Mar 2008 09:38:53 -0700 (MST) (envelope-from jhein@timing.com) Received: from gromit.timing.com (localhost [127.0.0.1]) by gromit.timing.com (8.14.2/8.14.2) with ESMTP id m22GcpMD058085; Sun, 2 Mar 2008 09:38:51 -0700 (MST) (envelope-from jhein@gromit.timing.com) Received: (from jhein@localhost) by gromit.timing.com (8.14.2/8.14.2/Submit) id m22Gcpfv058082; Sun, 2 Mar 2008 09:38:51 -0700 (MST) (envelope-from jhein) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18378.55323.480165.918523@gromit.timing.com> Date: Sun, 2 Mar 2008 09:38:51 -0700 From: John E Hein To: threads@freebsd.org X-Mailer: VM 7.19 under Emacs 22.1.1 X-Virus-Scanned: ClamAV version 0.91.2, clamav-milter version 0.91.2 on Daffy.timing.com X-Virus-Status: Clean Cc: Subject: running threaded tasks in dynamically linked objects from a non-threaded app 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: Sun, 02 Mar 2008 17:18:49 -0000 I am having some issues with an application that uses... [1] perl to run test scripts [2] with eventually call modules in C modules [3] which link with a lib that contains pthread* references. When the tests run, one gets undefined references to pthread calls from the run-time linker. [1] the perl port was not built WITH_THREADS=yes (non-threaded is the default) [3] this lib was built with -pthread, but this does not contain an explicit dependency on any threading library. That's how our -pthread works (so one can decide at the time an application is linked which threading lib to use) workarounds: - LD_PRELOAD=/usr/lib/libthr.so (or libpthread.so if desired) - require perl to be built WITH_THREADS=yes for users of this application - build the lib in [3] with -lthr or -lpthread. This can break if perl in built WITH_THREADS=yes and the threading libs in [1] and [3] don't match. These all have weaknesses in one facet or another. Are there any different solutions? From owner-freebsd-threads@FreeBSD.ORG Sun Mar 2 17:43:43 2008 Return-Path: Delivered-To: threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A6461106566C for ; Sun, 2 Mar 2008 17:43:43 +0000 (UTC) (envelope-from mezz7@cox.net) Received: from eastrmmtao101.cox.net (eastrmmtao101.cox.net [68.230.240.7]) by mx1.freebsd.org (Postfix) with ESMTP id 87C908FC26 for ; Sun, 2 Mar 2008 17:43:26 +0000 (UTC) (envelope-from mezz7@cox.net) Received: from eastrmimpo03.cox.net ([68.1.16.126]) by eastrmmtao107.cox.net (InterMail vM.7.08.02.01 201-2186-121-102-20070209) with ESMTP id <20080302173212.CBOG11832.eastrmmtao107.cox.net@eastrmimpo03.cox.net>; Sun, 2 Mar 2008 12:32:12 -0500 Received: from mezz.mezzweb.com ([24.255.149.218]) by eastrmimpo03.cox.net with bizsmtp id wHSd1Y0014iy4EG0000000; Sun, 02 Mar 2008 12:26:37 -0500 Date: Sun, 02 Mar 2008 11:33:35 -0600 To: "John E Hein" From: "Jeremy Messenger" Content-Type: text/plain; format=flowed; delsp=yes; charset=us-ascii MIME-Version: 1.0 References: <18378.55323.480165.918523@gromit.timing.com> Content-Transfer-Encoding: Quoted-Printable Message-ID: In-Reply-To: <18378.55323.480165.918523@gromit.timing.com> User-Agent: Opera Mail/9.26 (Linux) Cc: threads@freebsd.org Subject: Re: running threaded tasks in dynamically linked objects from a non-threaded app 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: Sun, 02 Mar 2008 17:43:43 -0000 On Sun, 02 Mar 2008 10:38:51 -0600, John E Hein wrote= : > I am having some issues with an application that uses... > [1] perl to run test scripts > [2] with eventually call modules in C modules > [3] which link with a lib that contains pthread* references. > > When the tests run, one gets undefined references to pthread calls > from the run-time linker. > > [1] the perl port was not built WITH_THREADS=3Dyes (non-threaded > is the default) > [3] this lib was built with -pthread, but this does not contain > an explicit dependency on any threading library. That's > how our -pthread works (so one can decide at the time an > application is linked which threading lib to use) > > workarounds: > - LD_PRELOAD=3D/usr/lib/libthr.so (or libpthread.so if desired) > - require perl to be built WITH_THREADS=3Dyes for > users of this application > - build the lib in [3] with -lthr or -lpthread. This > can break if perl in built WITH_THREADS=3Dyes and > the threading libs in [1] and [3] don't match. > > These all have weaknesses in one facet or another. > Are there any different solutions? Are you using FreeBSD 6.x or below? I think it has been fixed in FreeBSD= = 7.x and above with GCC 4.x. I only have tested it with Ruby. Cheers, Mezz -- = mezz7@cox.net - mezz@FreeBSD.org FreeBSD GNOME Team http://www.FreeBSD.org/gnome/ - gnome@FreeBSD.org From owner-freebsd-threads@FreeBSD.ORG Mon Mar 3 02:20:25 2008 Return-Path: Delivered-To: threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 196B5106566C for ; Mon, 3 Mar 2008 02:20:25 +0000 (UTC) (envelope-from jhein@timing.com) Received: from Daffy.timing.com (daffy.timing.com [206.168.13.218]) by mx1.freebsd.org (Postfix) with ESMTP id BEFC08FC1E for ; Mon, 3 Mar 2008 02:20:24 +0000 (UTC) (envelope-from jhein@timing.com) Received: from gromit.timing.com (gromit.timing.com [206.168.13.209]) by Daffy.timing.com (8.13.1/8.13.1) with ESMTP id m232KM5C090329; Sun, 2 Mar 2008 19:20:22 -0700 (MST) (envelope-from jhein@timing.com) Received: from gromit.timing.com (localhost [127.0.0.1]) by gromit.timing.com (8.14.2/8.14.2) with ESMTP id m232KMnE076857; Sun, 2 Mar 2008 19:20:22 -0700 (MST) (envelope-from jhein@gromit.timing.com) Received: (from jhein@localhost) by gromit.timing.com (8.14.2/8.14.2/Submit) id m232KLsB076853; Sun, 2 Mar 2008 19:20:21 -0700 (MST) (envelope-from jhein) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <18379.24676.854429.480513@gromit.timing.com> Date: Sun, 2 Mar 2008 19:20:20 -0700 From: John E Hein To: "Jeremy Messenger" In-Reply-To: References: <18378.55323.480165.918523@gromit.timing.com> X-Mailer: VM 7.19 under Emacs 22.1.1 X-Virus-Scanned: ClamAV version 0.91.2, clamav-milter version 0.91.2 on Daffy.timing.com X-Virus-Status: Clean Cc: threads@freebsd.org Subject: Re: running threaded tasks in dynamically linked objects from a non-threaded app 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, 03 Mar 2008 02:20:25 -0000 Jeremy Messenger wrote at 11:33 -0600 on Mar 2, 2008: > On Sun, 02 Mar 2008 10:38:51 -0600, John E Hein wrote: > > I am having some issues with an application that uses... > > [1] perl to run test scripts > > [2] with eventually call modules in C modules > > [3] which link with a lib that contains pthread* references. > > > > When the tests run, one gets undefined references to pthread calls > > from the run-time linker. > > > > [1] the perl port was not built WITH_THREADS=yes (non-threaded > > is the default) > > [3] this lib was built with -pthread, but this does not contain > > an explicit dependency on any threading library. That's > > how our -pthread works (so one can decide at the time an > > application is linked which threading lib to use) > > > > workarounds: > > - LD_PRELOAD=/usr/lib/libthr.so (or libpthread.so if desired) > > - require perl to be built WITH_THREADS=yes for > > users of this application > > - build the lib in [3] with -lthr or -lpthread. This > > can break if perl in built WITH_THREADS=yes and > > the threading libs in [1] and [3] don't match. > > > > These all have weaknesses in one facet or another. > > Are there any different solutions? > > Are you using FreeBSD 6.x or below? I think it has been fixed in FreeBSD > 7.x and above with GCC 4.x. I only have tested it with Ruby. I had tried it first with 6.x. After your reply, I ran off to try it on 7.x. It did not have undefined references. The difference seems to be that the lib (in [3]) now shows an explicit dependency on libthr.so.3. So -pthread behaves differently in 6.x vs. 7.x in this regard. _What_, specifically, has been "fixed" and how? And what happens if one does something like this on 7.x... gcc -pthread -shared foo.c -o foo.so (assuming the default pthread lib is libthr) gcc -lkse bar.c foo.so -o bar ... where both bar.c does some pthread* calls and foo.c does some pthread* calls. Is the libthr linking of foo.so overridden by libkse of the main app in bar.c so no conflicting threading library calls occur? In other words does the whole app use libkse calls due to the weak refs in all libs involved (libc, libthr, libkse)? This sounds perfectly reasonable, so I'm just talking this through. I am curious what the problem was with gcc 3.2 / freebsd 6.x, however. So, if this all does the right thing in gcc 4.2, it sounds like a reasonable workaround is to compile my app with ports/lang/gcc42 on 6.x From owner-freebsd-threads@FreeBSD.ORG Mon Mar 3 02:59:14 2008 Return-Path: Delivered-To: threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EAD4106566B for ; Mon, 3 Mar 2008 02:59:14 +0000 (UTC) (envelope-from mezz7@cox.net) Received: from eastrmmtao102.cox.net (eastrmmtao102.cox.net [68.230.240.8]) by mx1.freebsd.org (Postfix) with ESMTP id E04918FC24 for ; Mon, 3 Mar 2008 02:59:13 +0000 (UTC) (envelope-from mezz7@cox.net) Received: from eastrmimpo03.cox.net ([68.1.16.126]) by eastrmmtao102.cox.net (InterMail vM.7.08.02.01 201-2186-121-102-20070209) with ESMTP id <20080303025914.TSRC19740.eastrmmtao102.cox.net@eastrmimpo03.cox.net>; Sun, 2 Mar 2008 21:59:14 -0500 Received: from mezz.mezzweb.com ([24.255.149.218]) by eastrmimpo03.cox.net with bizsmtp id wStZ1Y0064iy4EG0000000; Sun, 02 Mar 2008 21:53:33 -0500 Date: Sun, 02 Mar 2008 21:00:38 -0600 To: "John E Hein" From: "Jeremy Messenger" Content-Type: text/plain; format=flowed; delsp=yes; charset=us-ascii MIME-Version: 1.0 References: <18378.55323.480165.918523@gromit.timing.com> <18379.24676.854429.480513@gromit.timing.com> Content-Transfer-Encoding: Quoted-Printable Message-ID: In-Reply-To: <18379.24676.854429.480513@gromit.timing.com> User-Agent: Opera Mail/9.26 (Linux) Cc: threads@freebsd.org Subject: Re: running threaded tasks in dynamically linked objects from a non-threaded app 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, 03 Mar 2008 02:59:14 -0000 On Sun, 02 Mar 2008 20:20:20 -0600, John E Hein wrote= : > Jeremy Messenger wrote at 11:33 -0600 on Mar 2, 2008: > > On Sun, 02 Mar 2008 10:38:51 -0600, John E Hein = = > wrote: > > > I am having some issues with an application that uses... > > > [1] perl to run test scripts > > > [2] with eventually call modules in C modules > > > [3] which link with a lib that contains pthread* references. > > > > > > When the tests run, one gets undefined references to pthread call= s > > > from the run-time linker. > > > > > > [1] the perl port was not built WITH_THREADS=3Dyes (non-threaded > > > is the default) > > > [3] this lib was built with -pthread, but this does not contain > > > an explicit dependency on any threading library. That's > > > how our -pthread works (so one can decide at the time an > > > application is linked which threading lib to use) > > > > > > workarounds: > > > - LD_PRELOAD=3D/usr/lib/libthr.so (or libpthread.so if desired) > > > - require perl to be built WITH_THREADS=3Dyes for > > > users of this application > > > - build the lib in [3] with -lthr or -lpthread. This > > > can break if perl in built WITH_THREADS=3Dyes and > > > the threading libs in [1] and [3] don't match. > > > > > > These all have weaknesses in one facet or another. > > > Are there any different solutions? > > > > Are you using FreeBSD 6.x or below? I think it has been fixed in = > FreeBSD > > 7.x and above with GCC 4.x. I only have tested it with Ruby. > > I had tried it first with 6.x. > > After your reply, I ran off to try it on 7.x. > It did not have undefined references. > > The difference seems to be that the lib (in [3]) now shows an > explicit dependency on libthr.so.3. So -pthread behaves differently > in 6.x vs. 7.x in this regard. > > > _What_, specifically, has been "fixed" and how? I personal don't really understand why or how problem in FreeBSD 6.x/GCC= = 3.x. Someone has suggested me that it's GCC 4.x that help this issue in = = FreeBSD 7.x and above. There is still one more problem with -pthread = stuff, bland has a simple C test and it will crashing. I can dig up in m= y = Inbox if anyone want this simple C test and a bit explain by bland. In past, I wrestled with ruby for -pthread stuff. I have added the = -phtread ruby in build even with threads option disable to solve other = ports problem. I had to keep remind to someone that who touch Ruby port = = when they think that add -pthread with threads option disable is = incorrect. :-) http://lists.freebsd.org/pipermail/cvs-ports/2005-February/058420.html http://lists.freebsd.org/pipermail/cvs-ports/2006-May/095213.html There is one problem with have ruby compiles with -pthread: http://www.freebsd.org/cgi/query-pr.cgi?pr=3D81464 But all of that have been solved in FreeBSD 7.x/GCC 4.x, so I am thinkin= g = about ask Ruby maintainer to see if he can get -pthread only compile on = = FreeBSD 6.x and below. The -pthread should be no longer need in FreeBSD = = 7.x and above for Ruby unless enable with threads option. > And what happens if one does something like this on 7.x... > > gcc -pthread -shared foo.c -o foo.so (assuming the default pthread = lib > is libthr) > gcc -lkse bar.c foo.so -o bar > > ... where both bar.c does some pthread* calls and foo.c does some > pthread* calls. Is the libthr linking of foo.so overridden by libkse > of the main app in bar.c so no conflicting threading library calls > occur? In other words does the whole app use libkse calls due to the > weak refs in all libs involved (libc, libthr, libkse)? This sounds > perfectly reasonable, so I'm just talking this through. I am curious > what the problem was with gcc 3.2 / freebsd 6.x, however. > > > So, if this all does the right thing in gcc 4.2, it sounds like a > reasonable workaround is to compile my app with ports/lang/gcc42 on 6.= x No idea, I don't have answer for that. I am going to let people that who= = understand this problem(s) to answer. :-) Cheers, Mezz -- = mezz7@cox.net - mezz@FreeBSD.org FreeBSD GNOME Team http://www.FreeBSD.org/gnome/ - gnome@FreeBSD.org From owner-freebsd-threads@FreeBSD.ORG Mon Mar 3 11:07:18 2008 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 59AB41065728 for ; Mon, 3 Mar 2008 11:07:18 +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 52B6B8FC12 for ; Mon, 3 Mar 2008 11:07:18 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m23B7IGN022216 for ; Mon, 3 Mar 2008 11:07:18 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m23B7HC8022212 for freebsd-threads@FreeBSD.org; Mon, 3 Mar 2008 11:07:17 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 3 Mar 2008 11:07:17 GMT Message-Id: <200803031107.m23B7HC8022212@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, 03 Mar 2008 11:07:18 -0000 Current FreeBSD problem reports Critical problems S Tracker Resp. Description -------------------------------------------------------------------------------- s threa/76690 threads fork hang in child for -lc_r 1 problem total. Serious problems S Tracker Resp. Description -------------------------------------------------------------------------------- s threa/24472 threads libc_r does not honor SO_SNDTIMEO/SO_RCVTIMEO socket o s threa/24632 threads libc_r delicate deviation from libc in handling SIGCHL s bin/32295 threads pthread dont dequeue signals s threa/34536 threads accept() blocks other threads s threa/39922 threads [threads] [patch] Threaded applications executed with s threa/48856 threads Setting SIGCHLD to SIG_IGN still leaves zombies under s threa/49087 threads Signals lost in programs linked with libc_r o threa/70975 threads unexpected and unreliable behaviour when using SYSV se o threa/72953 threads fork() unblocks blocked signals w/o PTHREAD_SCOPE_SYST o threa/75273 threads FBSD 5.3 libpthread (KSE) bug o threa/75374 threads pthread_kill() ignores SA_SIGINFO flag s threa/76694 threads fork cause hang in dup()/close() function in child (-l o threa/79683 threads svctcp_create() fails if multiple threads call at the o threa/80435 threads panic on high loads o threa/83914 threads [libc] popen() doesn't work in static threaded program s threa/84483 threads problems with devel/nspr and -lc_r on 4.x s threa/94467 threads send(), sendto() and sendmsg() are not correct in libc s threa/100815 threads FBSD 5.5 broke nanosleep in libc_r o threa/101323 threads fork(2) in threaded programs broken. o threa/103975 threads Implicit loading/unloading of libpthread.so may crash o threa/110636 threads [request] gdb(1): using gdb with multi thread applicat o threa/118715 threads kse problem 22 problems total. Non-critical problems S Tracker Resp. Description -------------------------------------------------------------------------------- s threa/30464 threads pthread mutex attributes -- pshared s threa/37676 threads libc_r: msgsnd(), msgrcv(), pread(), pwrite() need wra s threa/40671 threads pthread_cancel doesn't remove thread from condition qu s threa/69020 threads pthreads library leaks _gc_mutex o threa/79887 threads [patch] freopen() isn't thread-safe o threa/80992 threads abort() sometimes not caught by gdb depending on threa o threa/110306 threads apache 2.0 segmentation violation when calling gethost o threa/115211 threads pthread_atfork misbehaves in initial thread o threa/116181 threads /dev/io-related io access permissions are not propagat o threa/116668 threads can no longer use jdk15 with libthr on -stable SMP 10 problems total. From owner-freebsd-threads@FreeBSD.ORG Mon Mar 3 23:00:04 2008 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 1BDB41065672 for ; Mon, 3 Mar 2008 23:00: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 0B2098FC1C for ; Mon, 3 Mar 2008 23:00:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m23N03JI085788 for ; Mon, 3 Mar 2008 23:00:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m23N03ub085787; Mon, 3 Mar 2008 23:00:03 GMT (envelope-from gnats) Resent-Date: Mon, 3 Mar 2008 23:00:03 GMT Resent-Message-Id: <200803032300.m23N03ub085787@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, Frank DENIS Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ADA35106566C for ; Mon, 3 Mar 2008 22:51:47 +0000 (UTC) (envelope-from j@chiffon.c9x.org) Received: from comptine.c9x.org (comptine.c9x.org [88.191.38.240]) by mx1.freebsd.org (Postfix) with ESMTP id 5DD318FC1C for ; Mon, 3 Mar 2008 22:51:46 +0000 (UTC) (envelope-from j@chiffon.c9x.org) Received: from chiffon.c9x.org (chiffon.c9x.org [91.121.114.85]) by comptine.c9x.org (8.14.1/8.14.1) with ESMTP id m23MUblA007905 for ; Mon, 3 Mar 2008 23:30:37 +0100 (CET) Received: (from j@localhost) by chiffon.c9x.org (8.14.2/8.14.2/Submit) id m23MUW4G079898; Mon, 3 Mar 2008 23:30:32 +0100 (CET) (envelope-from j) Message-Id: <200803032230.m23MUW4G079898@chiffon.c9x.org> Date: Mon, 3 Mar 2008 23:30:32 +0100 (CET) From: Frank DENIS To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: threads/121336: lang/neko threading ok on UP, broken on SMP (FreeBSD 7) 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, 03 Mar 2008 23:00:04 -0000 >Number: 121336 >Category: threads >Synopsis: lang/neko threading ok on UP, broken on SMP (FreeBSD 7) >Confidential: no >Severity: serious >Priority: low >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Mar 03 23:00:03 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Frank DENIS >Release: FreeBSD 7.0-STABLE i386 >Organization: 42 Networks >Environment: System: FreeBSD chiffon.c9x.org 7.0-STABLE FreeBSD 7.0-STABLE #3: Sun Mar 2 12:45:50 CET 2008 root@chiffon.c9x.org:/usr/obj/usr/src/sys/SMP i386 >Description: ports/lang/neko perfectly works on FreeBSD 7.0 as long as there is only one core. On a SMP system, it crashes with a corrupted stack as soon as it tries to create a thread. The behavior can be reproduced with vmware. >How-To-Repeat: - Install neko from ports - Download ftp://ftp.c9x.org/misc/server.n - Run neko server.n 0.0.0.0 1935 - Try curl -v http://127.0.0.1:1935 - crash on SMP, ok on UP. >Fix: Don't know. Maybe boehm-gc releated. >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-threads@FreeBSD.ORG Tue Mar 4 04:00:01 2008 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 C309D1065677 for ; Tue, 4 Mar 2008 04:00:01 +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 AE8798FC18 for ; Tue, 4 Mar 2008 04:00:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m24401pc009375 for ; Tue, 4 Mar 2008 04:00:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m24401go009374; Tue, 4 Mar 2008 04:00:01 GMT (envelope-from gnats) Resent-Date: Tue, 4 Mar 2008 04:00:01 GMT Resent-Message-Id: <200803040400.m24401go009374@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, Josh Carroll Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CBE15106566C for ; Tue, 4 Mar 2008 03:51:16 +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 CB8268FC17 for ; Tue, 4 Mar 2008 03:51:16 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m243mIuE013299 for ; Tue, 4 Mar 2008 03:48:18 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.2/8.14.1/Submit) id m243mI8e013298; Tue, 4 Mar 2008 03:48:18 GMT (envelope-from nobody) Message-Id: <200803040348.m243mI8e013298@www.freebsd.org> Date: Tue, 4 Mar 2008 03:48:18 GMT From: Josh Carroll To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: threads/121343: pthread_cond_wait hanging in libthr 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, 04 Mar 2008 04:00:01 -0000 >Number: 121343 >Category: threads >Synopsis: pthread_cond_wait hanging in libthr >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Mar 04 04:00:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Josh Carroll >Release: 7.0-RELEASE >Organization: n/a >Environment: FreeBSD pflog.net 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Tue Feb 26 01:20:52 EST 2008 root@pflog.net:/usr/obj/usr/src/sys/PFLOG amd64 >Description: I have been debugging a problem with ushare in FreeBSD 7.0, specifically I have tracked it down to the pthread_cond_wait call inside the libupnp library that ushare uses. UpnpInit ultimately calls the below ithread_cond_wait, which is where I am seeing the "hang". The code in question is on line 650 of: /usr/ports/devel/upnp/work/libupnp-1.6.0/threadutil/src/ThreadPool.c 648 while( tp->totalThreads < currentThreads ) { 649 650 ithread_cond_wait( &tp->start_and_shutdown, &tp->mutex ); 651 652 } The call to ithread_cond_wait (#defined to pthread_cond_wait) hangs indefinitely, causing ushare to never listen on the UPnP port. It only does this when ushare is run with the -D option, indicating it should daemonize. If I run it without -D, it works fine. Here is the tail end of a truss of ushare when run with -D, at which point it hangs and subsequently does not listen on the UPnP socket. 22539: mprotect(0x7fffff9fe000,4096,PROT_NONE) = 0 (0x0) 22539: thr_new(0x7fffffffe590,0x68,0x7fffffffe620,0x0,0xffffffffb05a9d40,0x7fffffffe538) = 0 (0x0) 22539: _umtx_op(0x40e1c160,0x6,0x0,0x0,0x0,0x7fffffffe578) ERR#1 'Operation not permitted' 22539: _umtx_op(0x40e1e160,0x8,0x1,0x40e1e140,0x0,0x7fffffffe598)# and here's the tail end of the ktrace for the same: ushare CALL mmap(0x7fffff9fe000,0x201000,PROT_READ|PROT_WRITE,MAP_STACK,0xffffffff,0) ushare RET mmap -6299648/0x7fffff9fe000 ushare CALL mprotect(0x7fffff9fe000,0x1000,PROT_NONE) ushare RET mprotect 0 ushare CALL thr_new(0x7fffffffe9c0,0x68) ushare RET thr_new 0 ushare RET fork 0 ushare CALL _umtx_op(0x40e1e160,0x8,0x1,0x40e1e140,0) ushare RET _umtx_op -1 errno 1 Operation not permitted ushare CALL _umtx_op(0x40e1e140,0x5,0,0,0) ushare CALL _umtx_op(0x40e1c160,0x5,0,0,0) ushare RET _umtx_op RESTART ushare PSIG SIGTERM SIG_DFL I pointed ushare and libupnp.so to libkse instead with libmap.conf, and it works properly with libkse. It only exhibits this behavior with libthr. For now, I am using libmap.conf as a workaround, but there seems to be a problem with libthr in this particular usage. >How-To-Repeat: Since libupnp 1.6.0 doesn't compile on FreeBSD 7.0/amd64, I have been using 1.6.5, which includes my upstream source patch discussed here: http://www.freebsd.org/cgi/query-pr.cgi?pr=119120 I have a tarball of a upnp 1.6.5 setup here: http://pflog.net/new_upnp.tgz >Fix: >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-threads@FreeBSD.ORG Tue Mar 4 08:50:02 2008 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 A77131065673 for ; Tue, 4 Mar 2008 08:50:02 +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 A4BEF8FC22 for ; Tue, 4 Mar 2008 08:50:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m248o2tS034160 for ; Tue, 4 Mar 2008 08:50:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m248o2g8034159; Tue, 4 Mar 2008 08:50:02 GMT (envelope-from gnats) Date: Tue, 4 Mar 2008 08:50:02 GMT Message-Id: <200803040850.m248o2g8034159@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: David Xu Cc: Subject: Re: threads/121343: pthread_cond_wait hanging in libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: David Xu List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Mar 2008 08:50:02 -0000 The following reply was made to PR threads/121343; it has been noted by GNATS. From: David Xu To: Josh Carroll Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: threads/121343: pthread_cond_wait hanging in libthr Date: Tue, 04 Mar 2008 16:42:33 +0800 Josh Carroll wrote: >> Number: 121343 > The call to ithread_cond_wait (#defined to pthread_cond_wait) hangs > indefinitely, causing ushare to never listen on the UPnP port. It only > does this when ushare is run with the -D option, indicating it should > daemonize. If I run it without -D, it works fine. > > Here is the tail end of a truss of ushare when run with -D, at which > point it hangs and subsequently does not listen on the UPnP socket. > Can you attach to the process and see all threads info and backtrace ? for example: gdb /usr/local/bin/ushare 13323 (gdb) info threads ... From owner-freebsd-threads@FreeBSD.ORG Tue Mar 4 17:00:02 2008 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 E609A1065674 for ; Tue, 4 Mar 2008 17:00:02 +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 D798D8FC2E for ; Tue, 4 Mar 2008 17:00:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m24H02XP070296 for ; Tue, 4 Mar 2008 17:00:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m24H02H8070295; Tue, 4 Mar 2008 17:00:02 GMT (envelope-from gnats) Date: Tue, 4 Mar 2008 17:00:02 GMT Message-Id: <200803041700.m24H02H8070295@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: "Josh Carroll" Cc: Subject: Re: threads/121343: pthread_cond_wait hanging in libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Josh Carroll List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Mar 2008 17:00:03 -0000 The following reply was made to PR threads/121343; it has been noted by GNATS. From: "Josh Carroll" To: "David Xu" Cc: freebsd-gnats-submit@freebsd.org Subject: Re: threads/121343: pthread_cond_wait hanging in libthr Date: Tue, 4 Mar 2008 11:34:23 -0500 > Can you attach to the process and see all threads info and backtrace ? > for example: > gdb /usr/local/bin/ushare 13323 > > (gdb) info threads I can get a backtrace but not the thread information: (gdb) bt #0 0x00000000409d08da in _umtx_op () from /lib/libc.so.7 #1 0x0000000040ba5c9a in pthread_cleanup_push () from /lib/libthr.so.3 #2 0x0000000040ba231b in pthread_mutex_getprioceiling () from /lib/libthr.so.3 #3 0x0000000040774324 in WorkerThread (arg=0x40770d20) at src/ThreadPool.c:440 #4 0x0000000040b9f459 in pthread_getprio () from /lib/libthr.so.3 #5 0x0000000000000000 in ?? () Error accessing memory address 0x7fffffbff000: Bad address. (gdb) info threads Cannot get thread info: invalid key Is there something I'm doing wrong here? From owner-freebsd-threads@FreeBSD.ORG Wed Mar 5 00:00:08 2008 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 9136E106566C for ; Wed, 5 Mar 2008 00:00:08 +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 6704E8FC1C for ; Wed, 5 Mar 2008 00:00:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m25007ua005084 for ; Wed, 5 Mar 2008 00:00:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m25007J6005083; Wed, 5 Mar 2008 00:00:07 GMT (envelope-from gnats) Date: Wed, 5 Mar 2008 00:00:07 GMT Message-Id: <200803050000.m25007J6005083@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: Frank Denis Cc: Subject: Re: threads/121336: lang/neko threading ok on UP, broken on SMP (FreeBSD 7) X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Frank Denis List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Mar 2008 00:00:08 -0000 The following reply was made to PR threads/121336; it has been noted by GNATS. From: Frank Denis To: bug-followup@freebsd.org Cc: Subject: Re: threads/121336: lang/neko threading ok on UP, broken on SMP (FreeBSD 7) Date: Wed, 5 Mar 2008 00:17:03 +0100 The Neko virtual machine is indeed broken on FreeBSD 7 + SMP. Here's a very simple way to make it crash. Just create a thread. $ echo '$loader.loadprim("std@thread_create", 2)(function(z) { $print(z) }, "OK");' > nekothread.neko $ nekoc nekothread.neko $ neko nekothread.n From owner-freebsd-threads@FreeBSD.ORG Wed Mar 5 02:10:02 2008 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 ABCB21065670 for ; Wed, 5 Mar 2008 02:10:02 +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 9769F8FC14 for ; Wed, 5 Mar 2008 02:10:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m252A23D014651 for ; Wed, 5 Mar 2008 02:10:02 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m252A2DW014644; Wed, 5 Mar 2008 02:10:02 GMT (envelope-from gnats) Date: Wed, 5 Mar 2008 02:10:02 GMT Message-Id: <200803050210.m252A2DW014644@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: "Josh Carroll" Cc: Subject: Re: threads/121343: pthread_cond_wait hanging in libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Josh Carroll List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Mar 2008 02:10:02 -0000 The following reply was made to PR threads/121343; it has been noted by GNATS. From: "Josh Carroll" To: "David Xu" Cc: freebsd-gnats-submit@freebsd.org Subject: Re: threads/121343: pthread_cond_wait hanging in libthr Date: Tue, 4 Mar 2008 21:03:43 -0500 > > Can you attach to the process and see all threads info and backtrace ? > > for example: > > gdb /usr/local/bin/ushare 13323 > > > > (gdb) info threads Just for a comparison, here is the info threads output for ushare running with libkse: (gdb) info threads * 9 LWP 100372 0x0000000040bb566c in pthread_atfork () from /usr/lib/libkse.so 8 Thread 0x40e19400 (sleeping) 0x0000000040baf2a1 in pthread_kill () from /usr/lib/libkse.so 7 Thread 0x40e19800 (LWP 100267) 0x0000000040bb566c in pthread_atfork () from /usr/lib/libkse.so 6 Thread 0x40e19c00 (sleeping) 0x0000000040baf2a1 in pthread_kill () from /usr/lib/libkse.so 5 Thread 0x40e1a400 (sleeping) 0x0000000040baf2a1 in pthread_kill () from /usr/lib/libkse.so 4 Thread 0x40e1a800 (sleeping) 0x0000000040baf2a1 in pthread_kill () from /usr/lib/libkse.so 3 Thread 0x40e1ac00 (sleeping) 0x0000000040baf2a1 in pthread_kill () from /usr/lib/libkse.so 2 Thread 0x40e1b400 (sleeping) 0x0000000040baf2a1 in pthread_kill () from /usr/lib/libkse.so 1 Thread 0x40e1b800 (runnable) 0x0000000040a5686c in select () from /lib/libc.so.7 (gdb) bt #0 0x0000000040bb566c in pthread_atfork () from /usr/lib/libkse.so #1 0x0000000040bac049 in pthread_kill () from /usr/lib/libkse.so #2 0x0000000040baf88f in pthread_kill () from /usr/lib/libkse.so #3 0x0000000040bb09cf in pthread_setconcurrency () from /usr/lib/libkse.so #4 0x0000000000000000 in ?? () #5 0x0000000000000000 in ?? () (a whole slew of these, I stopped at about 20,000) Thanks, Josh From owner-freebsd-threads@FreeBSD.ORG Wed Mar 5 03:00:06 2008 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 315311065670 for ; Wed, 5 Mar 2008 03:00: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 1C23A8FC24 for ; Wed, 5 Mar 2008 03:00:06 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m25306d1018752 for ; Wed, 5 Mar 2008 03:00:06 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m25305kE018751; Wed, 5 Mar 2008 03:00:05 GMT (envelope-from gnats) Date: Wed, 5 Mar 2008 03:00:05 GMT Message-Id: <200803050300.m25305kE018751@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: David Xu Cc: Subject: Re: threads/121343: pthread_cond_wait hanging in libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: David Xu List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Mar 2008 03:00:06 -0000 The following reply was made to PR threads/121343; it has been noted by GNATS. From: David Xu To: josh.carroll@gmail.com Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: threads/121343: pthread_cond_wait hanging in libthr Date: Wed, 05 Mar 2008 10:51:35 +0800 Josh Carroll wrote: >> Can you attach to the process and see all threads info and backtrace ? >> for example: >> gdb /usr/local/bin/ushare 13323 >> >> (gdb) info threads > > I can get a backtrace but not the thread information: > > (gdb) bt > #0 0x00000000409d08da in _umtx_op () from /lib/libc.so.7 > #1 0x0000000040ba5c9a in pthread_cleanup_push () from /lib/libthr.so.3 > #2 0x0000000040ba231b in pthread_mutex_getprioceiling () from /lib/libthr.so.3 > #3 0x0000000040774324 in WorkerThread (arg=0x40770d20) at src/ThreadPool.c:440 > #4 0x0000000040b9f459 in pthread_getprio () from /lib/libthr.so.3 > #5 0x0000000000000000 in ?? () > Error accessing memory address 0x7fffffbff000: Bad address. > (gdb) info threads > Cannot get thread info: invalid key > > Is there something I'm doing wrong here? > This should not happen, I am not sure if there is memory problem in the program. Regards, David Xu From owner-freebsd-threads@FreeBSD.ORG Wed Mar 5 03:10:04 2008 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 64A3E106566B for ; Wed, 5 Mar 2008 03:10: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 4EFFE8FC1A for ; Wed, 5 Mar 2008 03:10:04 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m253A4Tu019314 for ; Wed, 5 Mar 2008 03:10:04 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m253A4hm019313; Wed, 5 Mar 2008 03:10:04 GMT (envelope-from gnats) Date: Wed, 5 Mar 2008 03:10:04 GMT Message-Id: <200803050310.m253A4hm019313@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: "Josh Carroll" Cc: Subject: Re: threads/121343: pthread_cond_wait hanging in libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Josh Carroll List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Mar 2008 03:10:04 -0000 The following reply was made to PR threads/121343; it has been noted by GNATS. From: "Josh Carroll" To: "David Xu" Cc: freebsd-gnats-submit@freebsd.org Subject: Re: threads/121343: pthread_cond_wait hanging in libthr Date: Tue, 4 Mar 2008 22:01:54 -0500 > This should not happen, I am not sure if there is memory problem in the > program. > > Regards, > David Xu > Here is what I see when gdb first starts, libthr/error emphasized by inserting blank lines around those parts of the gdb output: Attaching to program: /usr/local/bin/ushare, process 68900 Reading symbols from /usr/local/lib/libupnp.so.3...done. Loaded symbols for /usr/local/lib/libupnp.so.3 Reading symbols from /usr/local/lib/libthreadutil.so.4...done. Loaded symbols for /usr/local/lib/libthreadutil.so.4 Reading symbols from /usr/local/lib/libixml.so.2...done. Loaded symbols for /usr/local/lib/libixml.so.2 Reading symbols from /lib/libc.so.7...done. Loaded symbols for /lib/libc.so.7 Reading symbols from /lib/libthr.so.3...done. [New Thread 0x40e01290 (LWP 100363)] Error while reading shared library symbols: Cannot get thread info: invalid key Reading symbols from /usr/lib/liblwres.so.30...done. Loaded symbols for /usr/lib/liblwres.so.30 Reading symbols from /libexec/ld-elf.so.1...done. Loaded symbols for /libexec/ld-elf.so.1 0x00000000409d08da in _umtx_op () from /lib/libc.so.7 Perhaps I need to rebuild libthr? Josh From owner-freebsd-threads@FreeBSD.ORG Wed Mar 5 03:20:03 2008 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 D98FA1065682 for ; Wed, 5 Mar 2008 03:20: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 C45708FC37 for ; Wed, 5 Mar 2008 03:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m253K3kb020874 for ; Wed, 5 Mar 2008 03:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m253K3vP020870; Wed, 5 Mar 2008 03:20:03 GMT (envelope-from gnats) Date: Wed, 5 Mar 2008 03:20:03 GMT Message-Id: <200803050320.m253K3vP020870@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: David Xu Cc: Subject: Re: threads/121343: pthread_cond_wait hanging in libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: David Xu List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Mar 2008 03:20:04 -0000 The following reply was made to PR threads/121343; it has been noted by GNATS. From: David Xu To: josh.carroll@gmail.com Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: threads/121343: pthread_cond_wait hanging in libthr Date: Wed, 05 Mar 2008 11:14:56 +0800 Josh Carroll wrote: >> This should not happen, I am not sure if there is memory problem in the >> program. >> >> Regards, >> David Xu >> > > Here is what I see when gdb first starts, libthr/error emphasized by > inserting blank lines around those parts of the gdb output: > > Attaching to program: /usr/local/bin/ushare, process 68900 > Reading symbols from /usr/local/lib/libupnp.so.3...done. > Loaded symbols for /usr/local/lib/libupnp.so.3 > Reading symbols from /usr/local/lib/libthreadutil.so.4...done. > Loaded symbols for /usr/local/lib/libthreadutil.so.4 > Reading symbols from /usr/local/lib/libixml.so.2...done. > Loaded symbols for /usr/local/lib/libixml.so.2 > Reading symbols from /lib/libc.so.7...done. > Loaded symbols for /lib/libc.so.7 > > Reading symbols from /lib/libthr.so.3...done. > [New Thread 0x40e01290 (LWP 100363)] > Error while reading shared library symbols: > Cannot get thread info: invalid key > > Reading symbols from /usr/lib/liblwres.so.30...done. > Loaded symbols for /usr/lib/liblwres.so.30 > Reading symbols from /libexec/ld-elf.so.1...done. > Loaded symbols for /libexec/ld-elf.so.1 > 0x00000000409d08da in _umtx_op () from /lib/libc.so.7 > > Perhaps I need to rebuild libthr? > > Josh > I don't know what really happened, but if your program is using threads, it is better to link it with thread library directly. Can you dump ldd result ? ldd /usr/local/bin/ushare I have ushare up and running: apple# ps xaHl | grep ushare 0 5235 1 0 8 0 5560 1768 nanslp Ss ?? 0:00.01 /usr/local/bin/ushare --daemon 0 5235 1 0 60 0 5560 1768 ucond Ss ?? 0:00.00 /usr/local/bin/ushare --daemon 0 5235 1 0 47 0 5560 1768 ucond Ss ?? 0:00.00 /usr/local/bin/ushare --daemon 0 5235 1 0 47 0 5560 1768 ucond Ss ?? 0:00.00 /usr/local/bin/ushare --daemon 0 5235 1 0 61 0 5560 1768 select Ss ?? 0:00.00 /usr/local/bin/ushare --daemon 0 5235 1 0 48 0 5560 1768 ucond Ss ?? 0:00.00 /usr/local/bin/ushare --daemon 0 5235 1 0 55 0 5560 1768 ucond Ss ?? 0:00.00 /usr/local/bin/ushare --daemon apple# sockstat -4l USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS root ushare 5235 4 tcp4 *:49152 *:* root ushare 5235 5 udp4 127.0.0.1:62809 *:* root ushare 5235 6 udp4 *:* *:* root ushare 5235 7 udp4 *:1900 *:* ... Regards, David Xu From owner-freebsd-threads@FreeBSD.ORG Wed Mar 5 03:30:03 2008 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 C1B031065673 for ; Wed, 5 Mar 2008 03:30: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 AB7C38FC1A for ; Wed, 5 Mar 2008 03:30:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m253U3bG021269 for ; Wed, 5 Mar 2008 03:30:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m253U37K021261; Wed, 5 Mar 2008 03:30:03 GMT (envelope-from gnats) Date: Wed, 5 Mar 2008 03:30:03 GMT Message-Id: <200803050330.m253U37K021261@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: "Josh Carroll" Cc: Subject: Re: threads/121343: pthread_cond_wait hanging in libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Josh Carroll List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Mar 2008 03:30:03 -0000 The following reply was made to PR threads/121343; it has been noted by GNATS. From: "Josh Carroll" To: "David Xu" Cc: freebsd-gnats-submit@freebsd.org Subject: Re: threads/121343: pthread_cond_wait hanging in libthr Date: Tue, 4 Mar 2008 22:22:44 -0500 > I don't know what really happened, but if your program is using > threads, it is better to link it with thread library directly. > Can you dump ldd result ? /usr/local/bin/ushare: libupnp.so.3 => /usr/local/lib/libupnp.so.3 (0x4063d000) libthreadutil.so.4 => /usr/local/lib/libthreadutil.so.4 (0x40771000) libixml.so.2 => /usr/local/lib/libixml.so.2 (0x40877000) libc.so.7 => /lib/libc.so.7 (0x40982000) libthr.so.3 => /lib/libthr.so.3 (0x40b97000) liblwres.so.30 => /usr/lib/liblwres.so.30 (0x40cac000) > I have ushare up and running: > apple# ps xaHl | grep ushare > apple# sockstat -4l root@pflog:~# ushare -D root@pflog:~# ps xaHl | grep ushare 0 14812 1 0 44 0 9260 1552 umtxn Ss ?? 0:00.00 ushare -D 0 14812 1 0 44 0 9260 1552 umtxn Ss ?? 0:00.00 ushare -D 0 14968 12265 0 44 0 5864 1160 - R+ p0 0:00.00 grep ushare root@pflog:~# sockstat -4l | grep ushare I created a new ushare.conf for the above, which contains only: USHARE_NAME=test USHARE_IFACE=em1 USHARE_PORT= USHARE_DIR=/tmp USHARE_OVERRIDE_ICONV_ERR= Thanks, Josh From owner-freebsd-threads@FreeBSD.ORG Wed Mar 5 03:30:08 2008 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 95934106566C for ; Wed, 5 Mar 2008 03:30:08 +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 7FF898FC1F for ; Wed, 5 Mar 2008 03:30:08 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m253U8rc021684 for ; Wed, 5 Mar 2008 03:30:08 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m253U88M021681; Wed, 5 Mar 2008 03:30:08 GMT (envelope-from gnats) Date: Wed, 5 Mar 2008 03:30:08 GMT Message-Id: <200803050330.m253U88M021681@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: David Xu Cc: Subject: Re: threads/121343: pthread_cond_wait hanging in libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: David Xu List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Mar 2008 03:30:08 -0000 The following reply was made to PR threads/121343; it has been noted by GNATS. From: David Xu To: josh.carroll@gmail.com Cc: freebsd-gnats-submit@FreeBSD.org Subject: Re: threads/121343: pthread_cond_wait hanging in libthr Date: Wed, 05 Mar 2008 11:30:06 +0800 Josh Carroll wrote: >> I don't know what really happened, but if your program is using >> threads, it is better to link it with thread library directly. >> Can you dump ldd result ? > > /usr/local/bin/ushare: > libupnp.so.3 => /usr/local/lib/libupnp.so.3 (0x4063d000) > libthreadutil.so.4 => /usr/local/lib/libthreadutil.so.4 (0x40771000) > libixml.so.2 => /usr/local/lib/libixml.so.2 (0x40877000) > libc.so.7 => /lib/libc.so.7 (0x40982000) > libthr.so.3 => /lib/libthr.so.3 (0x40b97000) > liblwres.so.30 => /usr/lib/liblwres.so.30 (0x40cac000) > OK. >> I have ushare up and running: >> apple# ps xaHl | grep ushare >> apple# sockstat -4l > > root@pflog:~# ushare -D > root@pflog:~# ps xaHl | grep ushare > 0 14812 1 0 44 0 9260 1552 umtxn Ss ?? 0:00.00 ushare -D > 0 14812 1 0 44 0 9260 1552 umtxn Ss ?? 0:00.00 ushare -D > 0 14968 12265 0 44 0 5864 1160 - R+ p0 0:00.00 grep ushare > root@pflog:~# sockstat -4l | grep ushare > > I created a new ushare.conf for the above, which contains only: > > USHARE_NAME=test > USHARE_IFACE=em1 > USHARE_PORT= > USHARE_DIR=/tmp > USHARE_OVERRIDE_ICONV_ERR= > > Thanks, > Josh > I added -lpthread to link command (I found you don't have it), and this is why it works on my machine, you might try it. cc -I/usr/local/include -O2 -fno-strict-aliasing -pipe -Wall -W -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT -L/usr/local/lib -o ushare cds.o cms.o msr.o http.o presentation.o metadata.o mime.o services.o buffer.o util_iconv.o content.o cfgparser.o trace.o redblack.o osdep.o ushare.o -lupnp - lthreadutil -lixml -lpthread From owner-freebsd-threads@FreeBSD.ORG Wed Mar 5 03:50:03 2008 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 95F7C1065671 for ; Wed, 5 Mar 2008 03:50: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 7CF0A8FC16 for ; Wed, 5 Mar 2008 03:50:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.2/8.14.2) with ESMTP id m253o30c023953 for ; Wed, 5 Mar 2008 03:50:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.2/8.14.1/Submit) id m253o3I8023952; Wed, 5 Mar 2008 03:50:03 GMT (envelope-from gnats) Date: Wed, 5 Mar 2008 03:50:03 GMT Message-Id: <200803050350.m253o3I8023952@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: "Josh Carroll" Cc: Subject: Re: threads/121343: pthread_cond_wait hanging in libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Josh Carroll List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Mar 2008 03:50:03 -0000 The following reply was made to PR threads/121343; it has been noted by GNATS. From: "Josh Carroll" To: "David Xu" Cc: freebsd-gnats-submit@freebsd.org Subject: Re: threads/121343: pthread_cond_wait hanging in libthr Date: Tue, 4 Mar 2008 22:42:02 -0500 > I added -lpthread to link command (I found you don't have it), > and this is why it works on my machine, you might try it. > > cc -I/usr/local/include -O2 -fno-strict-aliasing -pipe -Wall -W > -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_REENTRANT > -L/usr/local/lib -o ushare cds.o > cms.o msr.o http.o presentation.o metadata.o mime.o services.o > buffer.o util_iconv.o content.o cfgparser.o trace.o redblack.o osdep.o > ushare.o -lupnp - > lthreadutil -lixml -lpthread > Thank you, yes if I rebuild ushare and add -lpthread, it works properly then. It appears as though the ushare port's Makefile is explicitly not adding -lpthread for 7.0: .if ${OSVERSION} < 700042 CFLAGS+= ${PTHREAD_LIBS} .endif I don't know the reasoning behind that, but I'll submit a PR to the ushare maintainer to have this fixed. Thank you very much for your time! I appreciate your help. Regards, Josh