From owner-freebsd-threads@freebsd.org Wed Jun 8 04:33:10 2016 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01B68B6F499 for ; Wed, 8 Jun 2016 04:33:10 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vps1.elischer.org", Issuer "CA Cert Signing Authority" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D84351159 for ; Wed, 8 Jun 2016 04:33:09 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from Julian-MBP3.local (ppp121-45-225-151.lns20.per1.internode.on.net [121.45.225.151]) (authenticated bits=0) by vps1.elischer.org (8.15.2/8.15.2) with ESMTPSA id u584WOfW029440 (version=TLSv1.2 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO) for ; Tue, 7 Jun 2016 21:32:27 -0700 (PDT) (envelope-from julian@freebsd.org) To: freebsd-threads@freebsd.org From: Julian Elischer Subject: comment from a user... Message-ID: <86df5edc-87ce-89ef-7a30-23e068a6efcc@freebsd.org> Date: Wed, 8 Jun 2016 12:32:18 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.22 X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2016 04:33:10 -0000 I got the following from a user... He's (forced to) use FreeBSD 8 Is this still an issue? and does anyone have thoughts? ------------------------- Hi Julian, I have a set of code with a fairly strong unit test framework. This framework works on Windows (cygwin) and Linux amongst other platforms. While running tests I always verify all allocated memory is freed for good hygiene. I've been running a test which has a printf in it and the following stack: #3 0x0000000000405219 in calloc (count=1, size=80) at testrunner.c:642 #4 0x0000000806bd1ce4 in pthread_mutexattr_init () from /lib/libthr.so.3 #5 0x0000000806bd1f91 in pthread_mutex_getyieldloops_np () from /lib/libthr.so.3 #6 0x0000000806bd2b81 in pthread_mutex_lock () from /lib/libthr.so.3 #7 0x0000000806dcda13 in abort () from /lib/libc.so.7 #8 0x0000000806dcdab3 in abort () from /lib/libc.so.7 #9 0x0000000806dc91b9 in getenv () from /lib/libc.so.7 #10 0x0000000806dc37ae in open () from /lib/libc.so.7 #11 0x0000000806dc50ca in vfprintf () from /lib/libc.so.7 #12 0x0000000806db10fa in printf () from /lib/libc.so.7 This calloc'd memory never gets freed and forces my unit tests to fail. I know this is an extremely old version of FreeBSD, but I figured I'd let you know so that perhaps somebody, somewhere, might be interested in such things and get a hold of the stack trace. From owner-freebsd-threads@freebsd.org Wed Jun 8 04:44:39 2016 Return-Path: Delivered-To: freebsd-threads@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D3DA4B6F665 for ; Wed, 8 Jun 2016 04:44:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4792F1830; Wed, 8 Jun 2016 04:44:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u584iY8v059831 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 8 Jun 2016 07:44:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u584iY8v059831 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u584iY7D059830; Wed, 8 Jun 2016 07:44:34 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 8 Jun 2016 07:44:34 +0300 From: Konstantin Belousov To: Julian Elischer Cc: freebsd-threads@freebsd.org Subject: Re: comment from a user... Message-ID: <20160608044433.GW38613@kib.kiev.ua> References: <86df5edc-87ce-89ef-7a30-23e068a6efcc@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86df5edc-87ce-89ef-7a30-23e068a6efcc@freebsd.org> User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Jun 2016 04:44:39 -0000 On Wed, Jun 08, 2016 at 12:32:18PM +0800, Julian Elischer wrote: > I got the following from a user... > He's (forced to) use FreeBSD 8 > Is this still an issue? and does anyone have thoughts? > > ------------------------- > > Hi Julian, > I have a set of code with a fairly strong unit test framework. This > framework works on Windows (cygwin) and Linux amongst other > platforms. While running tests I always verify all allocated memory > is freed for good hygiene. > > I've been running a test which has a printf in it and the following stack: > #3 0x0000000000405219 in calloc (count=1, size=80) at testrunner.c:642 > #4 0x0000000806bd1ce4 in pthread_mutexattr_init () from /lib/libthr.so.3 > #5 0x0000000806bd1f91 in pthread_mutex_getyieldloops_np () from > /lib/libthr.so.3 > #6 0x0000000806bd2b81 in pthread_mutex_lock () from /lib/libthr.so.3 > #7 0x0000000806dcda13 in abort () from /lib/libc.so.7 > #8 0x0000000806dcdab3 in abort () from /lib/libc.so.7 > #9 0x0000000806dc91b9 in getenv () from /lib/libc.so.7 > #10 0x0000000806dc37ae in open () from /lib/libc.so.7 > #11 0x0000000806dc50ca in vfprintf () from /lib/libc.so.7 > #12 0x0000000806db10fa in printf () from /lib/libc.so.7 > > > This calloc'd memory never gets freed and forces my unit tests to fail. > > I know this is an extremely old version of FreeBSD, but I figured I'd > let you know so that perhaps somebody, somewhere, might be interested > in such things and get a hold of the stack trace. The backtrace is not useful, since without debugging information, closest symbols are matched, and we do not see real function calls. That said, our statically allocated locks allocate memory on the first touch. And since locks are statically allocated, the memory is never freed. I do not see anything wrong with that.