threaded, forked, rethreaded processes will deadlock

Tim Kientzle kientzle at freebsd.org
Thu Jan 8 22:39:31 PST 2009


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


More information about the freebsd-hackers mailing list