From owner-freebsd-threads@FreeBSD.ORG Sun Nov 16 19:20: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 24D361065686 for ; Sun, 16 Nov 2008 19:20: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 06E558FC1A for ; Sun, 16 Nov 2008 19:20: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.3/8.14.3) with ESMTP id mAGJK1J6032831 for ; Sun, 16 Nov 2008 19:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id mAGJK151032830; Sun, 16 Nov 2008 19:20:01 GMT (envelope-from gnats) Resent-Date: Sun, 16 Nov 2008 19:20:01 GMT Resent-Message-Id: <200811161920.mAGJK151032830@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, Peter Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 510451065678 for ; Sun, 16 Nov 2008 19:18:04 +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 452488FC19 for ; Sun, 16 Nov 2008 19:18:04 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.14.3/8.14.3) with ESMTP id mAGJI4fX086650 for ; Sun, 16 Nov 2008 19:18:04 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.14.3/8.14.3/Submit) id mAGJI4TI086649; Sun, 16 Nov 2008 19:18:04 GMT (envelope-from nobody) Message-Id: <200811161918.mAGJI4TI086649@www.freebsd.org> Date: Sun, 16 Nov 2008 19:18:04 GMT From: Peter To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: threads/128922: threads hang with xorg running 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, 16 Nov 2008 19:20:02 -0000 >Number: 128922 >Category: threads >Synopsis: threads hang with xorg running >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Nov 16 19:20:01 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Peter >Release: 7.0 >Organization: Private >Environment: FreeBSD 7.0-RELEASE-p5 amd64 >Description: The following program runs perfectly on FreeBSD 6.3 amd64 (with xorg running and without xorg running). But on FreeBSD 7.0 amd64 and 7.1 beta amd64 (only with xorg running) after a few seconds of working the thread "period_thread" hangs printing only one time a second and even less. Moreover, the whole system becomes slow though "top" does not show a heavy load. Tried on Intel E6600 and on Intel E1200 with the same result. Tried with GENERIC kernel "out of the box" and with my kernel configurations with the same result. Tried with 4BSD and ULE schedulers with the same result. #include #include #include #include void* thread(void* q) { const size_t SIZE = 500; volatile double vec[SIZE]; size_t cnt; for(cnt = 0; cnt < 1000000; ++cnt) { size_t i; for(i = 0; i < SIZE; ++i) { vec[i] = 0; } for(i = 0; i < SIZE; ++i) { vec[i] += i; vec[i] -= i; } } } void* period_thread(void* q) { int i; for(i = 0;;++i) { printf("period thread %i\n", i); usleep( 50 * 1000 ); } } int main( int argc, char** argv ) { pthread_t hs; pthread_create(&hs, NULL, period_thread, NULL); for(;;) { const size_t SIZE = 5; pthread_t h[SIZE]; size_t i; for(i = 0; i < SIZE; ++i) { pthread_create( &h[i], NULL, thread, NULL); } for(i = 0; i < SIZE; ++i) { pthread_join(h[i], NULL); } } } >How-To-Repeat: Run the program on FreeBSD 7.0 amd64 or 7.1 beta amd64 in xterm, konsole, etc (xorg running). >Fix: Patch attached with submission follows: #include #include #include #include void* thread(void* q) { const size_t SIZE = 500; volatile double vec[SIZE]; size_t cnt; for(cnt = 0; cnt < 1000000; ++cnt) { size_t i; for(i = 0; i < SIZE; ++i) { vec[i] = 0; } for(i = 0; i < SIZE; ++i) { vec[i] += i; vec[i] -= i; } } } void* period_thread(void* q) { int i; for(i = 0;;++i) { printf("period thread %i\n", i); usleep( 50 * 1000 ); } } int main( int argc, char** argv ) { pthread_t hs; pthread_create(&hs, NULL, period_thread, NULL); for(;;) { const size_t SIZE = 5; pthread_t h[SIZE]; size_t i; for(i = 0; i < SIZE; ++i) { pthread_create( &h[i], NULL, thread, NULL); } for(i = 0; i < SIZE; ++i) { pthread_join(h[i], NULL); } } } >Release-Note: >Audit-Trail: >Unformatted: From owner-freebsd-threads@FreeBSD.ORG Sun Nov 16 20:00:46 2008 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 045DD1065670 for ; Sun, 16 Nov 2008 20:00:46 +0000 (UTC) (envelope-from dreigcht@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.227]) by mx1.freebsd.org (Postfix) with ESMTP id D34A78FC0A for ; Sun, 16 Nov 2008 20:00:45 +0000 (UTC) (envelope-from dreigcht@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so2036144rvf.43 for ; Sun, 16 Nov 2008 12:00:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=KgHjIP/+Sgy0I6blp5PfHSBhes1gVaXY6lqM+fEkZeY=; b=wCdgI/+0XSwqhunqoZLdTEy8YMVfWR9Se0JJxpWA2EP9byUyEq4w0vQ4zNq/HWZUWO LiTF36X8+JOOVv2WkSPF9MNbBLaHOnkVbrEeQOl29G7QvWqSEBJdFXZlDtf4G7bGdqMq qoxiLKc+5h0IImm4arRod60RfTLihINghfX+U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=QsSkL6Seg2iui1a1HFppbxXS0GqL1eaXreen679oaVT29eyNeesW1pUa9pLf7J/6d1 taVUGiIRbencwpafeCQBPGBZkUGGYnVAYeTy1B7gbddsZOMg5hcl0imbkLDzyWwgU5sZ vHsx2n3quVIKxpWitx0a1YMyBQ/nwPP30IJyk= Received: by 10.142.174.18 with SMTP id w18mr1570153wfe.267.1226864186211; Sun, 16 Nov 2008 11:36:26 -0800 (PST) Received: by 10.143.160.10 with HTTP; Sun, 16 Nov 2008 11:36:25 -0800 (PST) Message-ID: Date: Sun, 16 Nov 2008 22:36:25 +0300 From: "Peter Dreight" To: freebsd-threads@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: threads hang with xorg running 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, 16 Nov 2008 20:00:46 -0000 The following program runs perfectly on FreeBSD 6.3 amd64 (with xorg running and without xorg running). But on FreeBSD 7.0 amd64 and 7.1 beta amd64 (only with xorg running - xterm - konsole - etc) after a few seconds of working the thread "period_thread" hangs printing only one time a second and even less. Moreover, the whole system becomes slow though "top" does not show a heavy load. Tried on Intel E6600 and on Intel E1200 with the same result. Tried with GENERIC kernel "out of the box" and with my kernel configurations with the same result. Tried with 4BSD and ULE schedulers with the same result. #include #include #include #include void* heavy_thread(void* q) { const size_t SIZE = 500; volatile double vec[SIZE]; size_t cnt; for(cnt = 0; cnt < 1000000; ++cnt) { size_t i; for(i = 0; i < SIZE; ++i) { vec[i] = 0; } for(i = 0; i < SIZE; ++i) { vec[i] += i; vec[i] -= i; } } } void* period_thread(void* q) { int i; for(i = 0;;++i) { printf("period thread %i\n", i); usleep( 50 * 1000 ); } } int main( int argc, char** argv ) { pthread_t hs; pthread_create(&hs, NULL, period_thread, NULL); for(;;) { const size_t SIZE = 5; pthread_t h[SIZE]; size_t i; for(i = 0; i < SIZE; ++i) { pthread_create( &h[i], NULL, heavy_thread, NULL); } for(i = 0; i < SIZE; ++i) { pthread_join(h[i], NULL); } } } From owner-freebsd-threads@FreeBSD.ORG Mon Nov 17 11:06:58 2008 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 C34671065675 for ; Mon, 17 Nov 2008 11:06:58 +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 B25CF8FC08 for ; Mon, 17 Nov 2008 11:06:58 +0000 (UTC) (envelope-from owner-bugmaster@FreeBSD.org) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id mAHB6wEm082689 for ; Mon, 17 Nov 2008 11:06:58 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id mAHB6wXA082685 for freebsd-threads@FreeBSD.org; Mon, 17 Nov 2008 11:06:58 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 17 Nov 2008 11:06:58 GMT Message-Id: <200811171106.mAHB6wXA082685@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, 17 Nov 2008 11:06:58 -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/128922 threads threads hang with xorg running o threa/128180 threads pthread_cond_broadcast(3) lost wakeup 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 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/75374 threads pthread_kill() ignores SA_SIGINFO flag 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 kern/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 38 problems total. From owner-freebsd-threads@FreeBSD.ORG Tue Nov 18 11:30:05 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 C1CE7106564A for ; Tue, 18 Nov 2008 11:30:05 +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 B26E48FC18 for ; Tue, 18 Nov 2008 11:30:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id mAIBU54Y013987 for ; Tue, 18 Nov 2008 11:30:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id mAIBU58r013984; Tue, 18 Nov 2008 11:30:05 GMT (envelope-from gnats) Date: Tue, 18 Nov 2008 11:30:05 GMT Message-Id: <200811181130.mAIBU58r013984@freefall.freebsd.org> To: freebsd-threads@FreeBSD.org From: "Peter Dreight" Cc: Subject: Re: threads/128922: threads hang with xorg running X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Peter Dreight List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 18 Nov 2008 11:30:05 -0000 The following reply was made to PR threads/128922; it has been noted by GNATS. From: "Peter Dreight" To: bug-followup@freebsd.org Cc: Subject: Re: threads/128922: threads hang with xorg running Date: Tue, 18 Nov 2008 14:02:17 +0300 ------=_Part_56596_23614366.1227006137300 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Some additional information: The example works fine on FreeBSD 6.3: when linked with libpthread (-lpthread) or when linked with libthr (-lthr) The example works fine on FreeBSD 7.0 and 7.1: when linked with libkse (-lkse) The example does not work and threads hang as I described earlier: when linked with lthr (-lthr or -lpthread that is the same on FreeBSD 7). Therefore it seems to me that there is some problem in the new version of the library "libthr" included in FreeBSD 7.0 and 7.1. ------=_Part_56596_23614366.1227006137300 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Some additional information:

The example works fine on FreeBSD 6.3:
   when linked with libpthread (-lpthread)
  or
   when linked with libthr  (-lthr)

The example works fine on FreeBSD 7.0 and 7.1:
    when linked with libkse  (-lkse)

The example does not work and threads hang as I described earlier:
    when linked with lthr (-lthr or -lpthread that is the same on FreeBSD 7).

Therefore it seems to me that there is some problem in the new version
of the library "libthr" included in FreeBSD 7.0 and 7.1.
------=_Part_56596_23614366.1227006137300--