RFC: Deadlock in multithreaded application when doing IO and fork.

Rich Felker dalias@aerifal.cx
Fri Feb 1 20:53:00 GMT 2013


On Thu, Jan 31, 2013 at 06:02:38PM -0500, Carlos O'Donell wrote:
> Community,
> 
> I've seen what I believe to be the following deadlock
> scenario in a multithreaded application when doing 
> IO and forking. 
> 
> It is safe to call fork in a multthreaded environment. 

But not safe to use async-signal-unsafe functions in the child after
fork. In particular, malloc is not legal after fork in a
multi-threaded program, so the simplest solution would be to remove
all the atfork handling for malloc.

I realize however this may be unpopular...

Rich



More information about the Libc-alpha mailing list