tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: using of fork() in multithreaded application



On Fri, Jan 24, 2025 at 14:38:22 +0100, Jörg Sonnenberger wrote:

> On 1/24/25 1:27 PM, Greg Troxel wrote:
[...]
> > In 2010ish I saw a hard-to-find bug, the details of which are now fading
> > from memory.  I think it was some kind of lock taken in a routine that
> > was called after fork and before exec.  I think the program was python
> > and the lock was in libc's malloc. (This would have NetBSD 5 or 6.)
> 
> I've fixed various issues in libc to make fork-without-exec reasonable
> reliable for many use cases. malloc certainly was one of them.

That reminds me... (sorry if hijacking the thread).

When a user-supplied malloc is used (dmalloc &c, or program's own
malloc like e.g. in inferno-os), they do not override jemalloc fork
hooks as that's not part of malloc "API contract" so to say.  jemalloc
hooks are run on fork with unitialized jemalloc internals.

What is the right corse of action here?

-uwe


Home | Main Index | Thread Index | Old Index