From owner-freebsd-threads@FreeBSD.ORG Sun Nov 21 01:10:28 2004 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EE04516A4CE for ; Sun, 21 Nov 2004 01:10:27 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C2DDB43D46 for ; Sun, 21 Nov 2004 01:10:27 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) iAL1ARL5009835 for ; Sun, 21 Nov 2004 01:10:27 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.11/8.12.11/Submit) id iAL1ARwD009834; Sun, 21 Nov 2004 01:10:27 GMT (envelope-from gnats) Resent-Date: Sun, 21 Nov 2004 01:10:27 GMT Resent-Message-Id: <200411210110.iAL1ARwD009834@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, Pavel Kraynyukhov Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D2EB116A4CE for ; Sun, 21 Nov 2004 01:00:55 +0000 (GMT) Received: from www.freebsd.org (www.freebsd.org [216.136.204.117]) by mx1.FreeBSD.org (Postfix) with ESMTP id A33CE43D1D for ; Sun, 21 Nov 2004 01:00:55 +0000 (GMT) (envelope-from nobody@FreeBSD.org) Received: from www.freebsd.org (localhost [127.0.0.1]) by www.freebsd.org (8.13.1/8.13.1) with ESMTP id iAL10tUr055343 for ; Sun, 21 Nov 2004 01:00:55 GMT (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.13.1/8.13.1/Submit) id iAL10tPh055342; Sun, 21 Nov 2004 01:00:55 GMT (envelope-from nobody) Message-Id: <200411210100.iAL10tPh055342@www.freebsd.org> Date: Sun, 21 Nov 2004 01:00:55 GMT From: Pavel Kraynyukhov To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-2.3 Subject: threads/74180: KSE problem. Applications those riched maximum possible threads at a time, would hang on threads join. look at detailed description ! X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Nov 2004 01:10:28 -0000 >Number: 74180 >Category: threads >Synopsis: KSE problem. Applications those riched maximum possible threads at a time, would hang on threads join. look at detailed description ! >Confidential: no >Severity: non-critical >Priority: high >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Nov 21 01:10:26 GMT 2004 >Closed-Date: >Last-Modified: >Originator: Pavel Kraynyukhov >Release: 5.3 >Organization: private >Environment: FreeBSD ChainOfWorlds.InstantHQ.COM 5.3-RELEASE FreeBSD 5.3-RELEASE #0: Fri Nov 12 15:21:33 CET 2004 root@ChainOfWorlds.InstantHQ.COM:/usr/src/sys/i386/compile/ROMUL i386 >Description: Doing some measuring tests i found that application that creates a maximum possible threads in process, and then joins those threads after condition broadcasted, impossible to run more then once per boot. On second run the test hangs on threads joining. So you must reboot a PC to successfully pass this test again. >How-To-Repeat: compile following C++ test and run it twice or more times sequentually. first test will pass sucessfuly. second one (and all following) will hang on threads joining. #include #include #include #include #include #include pthread_cond_t WakeThemUp; pthread_mutex_t lock; void* thread(void* args) { pthread_mutex_lock(&lock); pthread_cond_wait(&WakeThemUp,&lock); pthread_mutex_unlock(&lock); /* for(size_t i=1; i< 1000;i++) { float m=i; m=log(sqrt(m*3.14/0.3876543234*234.765438/2.666666)); m+=i; }*/ } int main() { std::vector threads; size_t thrcount=0; pthread_cond_init(&WakeThemUp,NULL); pthread_mutex_init(&lock,NULL); clock_t start=clock(); clock_t end=0; try{ while(1) { pthread_t *threadP=new pthread_t; if(pthread_create(threadP,NULL,thread,NULL)==0) { threads.push_back(threadP); thrcount++; } else throw 1; } } catch( ... ) { end=clock(); std::cout << "threads created: " << thrcount << " ,\ creation time: " << end-start << " \ ticks" <<" CLOCKS_PER_SEC(" <Fix: >Release-Note: >Audit-Trail: >Unformatted: