From owner-freebsd-threads@FreeBSD.ORG Mon Apr 9 11:07:24 2012 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 46C28106566C for ; Mon, 9 Apr 2012 11:07:24 +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 1571C8FC24 for ; Mon, 9 Apr 2012 11:07:24 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q39B7NDH039763 for ; Mon, 9 Apr 2012 11:07:23 GMT (envelope-from owner-bugmaster@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q39B7Nk0039761 for freebsd-threads@FreeBSD.org; Mon, 9 Apr 2012 11:07:23 GMT (envelope-from owner-bugmaster@FreeBSD.org) Date: Mon, 9 Apr 2012 11:07:23 GMT Message-Id: <201204091107.q39B7Nk0039761@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, 09 Apr 2012 11:07:24 -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/165173 threads [build] clang buildworld breaks libthr o threa/163512 threads libc defaults to single threaded o threa/160708 threads possible security problem with RLIMIT_VMEM o threa/150959 threads [libc] Stub pthread_once in libc should call _libc_onc o threa/148515 threads Memory / syslog strangeness in FreeBSD 8.x ( possible o threa/141721 threads rtprio(1): (id|rt)prio priority resets when new thread o threa/135673 threads databases/mysql50-server - MySQL query lock-ups on 7.2 o threa/128922 threads threads hang with xorg running 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/116668 threads can no longer use jdk15 with libthr on -stable SMP 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/84483 threads problems with devel/nspr and -lc_r on 4.x o threa/80992 threads abort() sometimes not caught by gdb depending on threa 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/48856 threads Setting SIGCHLD to SIG_IGN still leaves zombies under s threa/34536 threads accept() blocks other threads s threa/30464 threads [patch] pthread mutex attributes -- pshared 23 problems total. From owner-freebsd-threads@FreeBSD.ORG Fri Apr 13 23:50:12 2012 Return-Path: Delivered-To: freebsd-threads@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id CC194106566C for ; Fri, 13 Apr 2012 23:50:12 +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 A329E8FC17 for ; Fri, 13 Apr 2012 23:50:12 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q3DNoChQ086248 for ; Fri, 13 Apr 2012 23:50:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q3DNoCFd086247; Fri, 13 Apr 2012 23:50:12 GMT (envelope-from gnats) Resent-Date: Fri, 13 Apr 2012 23:50:12 GMT Resent-Message-Id: <201204132350.q3DNoCFd086247@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, Dmitry Marakasov Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B28EF1065670 for ; Fri, 13 Apr 2012 23:45:21 +0000 (UTC) (envelope-from amdmi3@amdmi3.ru) Received: from smtp.timeweb.ru (smtp.timeweb.ru [92.53.116.15]) by mx1.freebsd.org (Postfix) with ESMTP id 27A0F8FC21 for ; Fri, 13 Apr 2012 23:45:19 +0000 (UTC) Received: from [213.148.20.85] (helo=hive.panopticon) by smtp.timeweb.ru with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.76) (envelope-from ) id 1SIqAz-0003HF-2M for FreeBSD-gnats-submit@freebsd.org; Sat, 14 Apr 2012 03:45:13 +0400 Received: from hades.panopticon (hades.panopticon [192.168.0.32]) by hive.panopticon (Postfix) with ESMTP id AA2F2B84D for ; Sat, 14 Apr 2012 03:45:12 +0400 (MSK) Received: by hades.panopticon (Postfix, from userid 1000) id 9B8A0906; Sat, 14 Apr 2012 03:45:12 +0400 (MSK) Message-Id: <20120413234512.9B8A0906@hades.panopticon> Date: Sat, 14 Apr 2012 03:45:12 +0400 (MSK) From: Dmitry Marakasov To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: threads/166932: sleepqueue-related memory leak in libthr X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Dmitry Marakasov List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Apr 2012 23:50:13 -0000 >Number: 166932 >Category: threads >Synopsis: sleepqueue-related memory leak in libthr >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-threads >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Apr 13 23:50:12 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Dmitry Marakasov >Release: FreeBSD 9.0-RELEASE amd64 >Organization: >Environment: System: FreeBSD hades.panopticon 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 10 01:33:18 MSK 2012 root@hades.panopticon:/usr/obj/usr/src/sys/HADES amd64 >Description: Seems like there's a memory leak in libthr when threads are created and joined continously. See attached program. It creates and joins 16 threads, and repeats that multiple times. If LOOPS = 1, there's no leak regardless of how many threads are created. If LOOPS > 1, there's a leak of 64 bytes per each created thread. With 1024 loops it's approx. 1MB which is visible in valgrind output: ==41498== HEAP SUMMARY: ==41498== in use at exit: 1,065,912 bytes in 16,402 blocks ==41498== total heap usage: 16,403 allocs, 1 frees, 1,065,992 bytes allocated ==41498== ==41498== Searching for pointers to 16,402 not-freed blocks ==41498== Checked 34,403,992 bytes ==41498== ==41498== 1,047,552 bytes in 16,368 blocks are definitely lost in loss record 5 of 5 ==41498== at 0x1004654: calloc (in /usr/local/lib/valgrind/vgpreload_memcheck-amd64-freebsd.so) ==41498== by 0x12166A5: _sleepq_alloc (in /lib/libthr.so.3) ==41498== by 0x121A497: _thr_alloc (in /lib/libthr.so.3) ==41498== by 0x121311D: pthread_create (in /lib/libthr.so.3) ==41498== by 0x400673: main (in /tmp/a.out) ==41498== ==41498== LEAK SUMMARY: ==41498== definitely lost: 1,047,552 bytes in 16,368 blocks ==41498== indirectly lost: 0 bytes in 0 blocks ==41498== possibly lost: 0 bytes in 0 blocks ==41498== still reachable: 18,360 bytes in 34 blocks ==41498== suppressed: 0 bytes in 0 blocks And if LOOPS is set to some value high enough (say, 102400), the leak may be seen with naked eye (process eats over 140MB as seen in top). >How-To-Repeat: #include #define LOOPS 1024 #define THREADS 16 void* threadfunc(void* arg) { return NULL; } int main() { int loop, thread; pthread_t threads[THREADS]; for (loop = 0; loop < LOOPS; ++loop) { for (thread = 0; thread < THREADS; ++thread) pthread_create(&threads[thread], NULL, threadfunc, NULL); for (thread = 0; thread < THREADS; ++thread) pthread_join(threads[thread], NULL); } return 0; } >Fix: >Release-Note: >Audit-Trail: >Unformatted: