Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jan 2009 22:44:20 -0500 (EST)
From:      Daniel Eischen <eischen@vigrid.com>
To:        Brian Fundakowski Feldman <green@freebsd.org>
Cc:        hackers@freebsd.org, jasone@freebsd.org
Subject:   Re: threaded, forked, rethreaded processes will deadlock
Message-ID:  <Pine.GSO.4.64.0901082237001.28531@sea.ntplx.net>
In-Reply-To: <20090109031942.GA2825@green.homeunix.org>
References:  <20090109031942.GA2825@green.homeunix.org>

next in thread | previous in thread | raw e-mail | index | archive | help
  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--VbJkn9YxBvnuCH5J
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Content-ID: <Pine.GSO.4.64.0901082237003.28531@sea.ntplx.net>
Content-Disposition: inline

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.

There's really nothing to fix - according to POSIX you are only
allowed to call async-signal-safe functions in the child forked
from a threaded process.  If you are trying to do anything other
than that, it may or may not work on FreeBSD, but it is not
guaranteed and is not portable.

The rationale is that what is the point of forking and creating
more threads, when you can just as easily create more threads in
the parent without forking?  The only reason to fork from a threaded
process is to call one of the exec() functions.

-- 
DE
--VbJkn9YxBvnuCH5J
Content-Type: TEXT/PLAIN; charset=us-ascii
Content-ID: <Pine.GSO.4.64.0901082237004.28531@sea.ntplx.net>
Content-Description: 
Content-Disposition: inline

_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
--VbJkn9YxBvnuCH5J--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.64.0901082237001.28531>