Open Bug 1376567 Opened 3 years ago Updated 1 year ago
Calling fork() during shutdown on Mac leads to a crash due to memory allocations
This is something we've experienced dealing with the crashreporter client as well as the pingsender. Apparently fork() on Mac is doing some memory allocations (possibly related to locking) so if it gets called late enough during shutdown it crashes the parent process.
Ted, I can't find the bug where we hit this. Do you remember which one it was? It would be great to have that stack trace showing the problem in action.
That was bug 1356673.
From my reading of the crash stacks from that bug, it looked like something was going wrong with the way jemalloc hooked into the system heap. attachment 8858399 [details] shows the forked process was crashing in libsystem_malloc in nano_reinit_lock by way of libSystem_atfork_child. I don't really know enough about our jemalloc implementation or OS X's system malloc to say anything more useful here, but I'd guess that something jemalloc is doing is not fork-safe.
Mike, we spoke about this during the all-hands closing party, in case you want to have a look :)
Clearing the needinfo since we've moved the affected code to use posix_spawnp(). Since fork() has other issues on Mac this is probably not worth investigating.
You need to log in before you can comment on or make changes to this bug.