From owner-freebsd-hackers@FreeBSD.ORG Fri Jan 9 06:39:30 2009 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70A0A1065733; Fri, 9 Jan 2009 06:39:30 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from kientzle.com (kientzle.com [66.166.149.50]) by mx1.freebsd.org (Postfix) with ESMTP id EFC378FC1B; Fri, 9 Jan 2009 06:39:29 +0000 (UTC) (envelope-from kientzle@freebsd.org) Received: from [10.123.2.23] (p53.kientzle.com [66.166.149.53]) by kientzle.com (8.12.9/8.12.9) with ESMTP id n096ODtv055374; Thu, 8 Jan 2009 22:24:13 -0800 (PST) (envelope-from kientzle@freebsd.org) Message-ID: <4966ED8A.4080307@freebsd.org> Date: Thu, 08 Jan 2009 22:24:10 -0800 From: Tim Kientzle User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.12) Gecko/20060422 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Brian Fundakowski Feldman References: <20090109031942.GA2825@green.homeunix.org> <20090109053117.GB2825@green.homeunix.org> In-Reply-To: <20090109053117.GB2825@green.homeunix.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Cc: hackers@freebsd.org, jasone@freebsd.org Subject: Re: threaded, forked, rethreaded processes will deadlock X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jan 2009 06:39:31 -0000 Brian Fundakowski Feldman wrote: > On Thu, Jan 08, 2009 at 10:44:20PM -0500, Daniel Eischen wrote: >>On Thu, 8 Jan 2009, Brian Fundakowski Feldman wrote: >> >>>It appears that the post-fork hooks for malloc(3) are somewhat broken such that >>>when a threaded program forks, and then its child attempts to go threaded, it >>>deadlocks because it already appears to have locks held. I am not familiar >>>enough with the current libthr/libc/rtld-elf interaction that I've been able >>>to fix it myself, unfortunately. What version of FreeBSD? I've only glanced through the relevant code, but the malloc() implementation in -CURRENT certainly tries to claim all malloc locks before the fork and releases them all (in both child and parent) just after the fork, so the scenario you describe shouldn't happen. Of course, there may be other locks getting in the way. Tim