From owner-freebsd-stable@FreeBSD.ORG Sat Feb 21 00:35:03 2015 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A454451A for ; Sat, 21 Feb 2015 00:35:03 +0000 (UTC) Received: from alogt.com (alogt.com [69.36.191.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7B4432A9 for ; Sat, 21 Feb 2015 00:35:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=alogt.com; s=default; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:To:From:Date; bh=M1XZz5Xza1oGGXO/gcVIRUw3OiPndXhCwjFW23hl0l4=; b=qiPcNKjD3CH7AYm63x80Kv6HbIvEaID26vTypMK23/VQw6ojkVVqkGXAe9OgWKgxFxOTm5DOEciz3xCb1vEphFsl8gioWWz5DXrYhF5xkD7yem2zC4sEZ9xE+Ke1JZXbU7vGl3JjFCfQC/WgnlDMEg8YImrXDLBovYGPQKqZqlU=; Received: from [114.124.24.228] (port=62440 helo=B85M-HD3-0.alogt.com) by sl-508-2.slc.westdc.net with esmtpsa (TLSv1.2:AES128-GCM-SHA256:128) (Exim 4.84) (envelope-from ) id 1YOy24-0022Ee-JW for freebsd-stable@freebsd.org; Fri, 20 Feb 2015 17:34:57 -0700 Date: Sat, 21 Feb 2015 08:34:44 +0800 From: Erich Dollansky To: freebsd-stable@freebsd.org Subject: Re: pthread leaky with resources? Message-ID: <20150221083444.5759b1d8@B85M-HD3-0.alogt.com> In-Reply-To: <54E75087.7080100@shrew.net> References: <54E65E05.2040101@shrew.net> <20150220100446.GL34251@kib.kiev.ua> <54E74D17.6020209@shrew.net> <54E75087.7080100@shrew.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - sl-508-2.slc.westdc.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - alogt.com X-Get-Message-Sender-Via: sl-508-2.slc.westdc.net: authenticated_id: erichsfreebsdlist@alogt.com X-Source: X-Source-Args: X-Source-Dir: X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Feb 2015 00:35:03 -0000 Hi, On Fri, 20 Feb 2015 09:19:35 -0600 Matthew Grooms wrote: > > When a thread is created, it will first try to reuse cached > > resources before allocating new resources. > > > > If you are creating 200 threads, for instance, try destroying those > > 200 threads, then create 200 new threads. You shouldn't see much > > change in resources, as libpthread should use the cached > > resources. If you see a double in the amount of resources used, > > then that would seem like a bug. > > > Thanks for the response. Let me do some more testing. I know that OS > developer time is a precious resource. If I can find more evidence of > the problem I will present it. > I am currently also working on a multi threaded program and have had also a problem like this. I thought it was an error 100% on my side. As I also did at the same time an upgrade to 10.1-STABLE FreeBSD 10.1-STABLE #2 r276328 it could be that there was really some problem in a library. Some of the threads just return while others are cancelled. If you have cancelled threads, do you use pthread_cleanup_push and pthread_cleanup_pop? Erich