Closed Bug 1376567 Opened 7 years ago Closed 3 years ago

Calling fork() during shutdown on Mac leads to a crash due to memory allocations


(Core :: Memory Allocator, defect, P3)






(Reporter: gsvelto, Unassigned)



(Keywords: crash)

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.
Flags: needinfo?(ted)
That was bug 1356673.
Flags: needinfo?(ted)
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 :)
Flags: needinfo?(mh+mozilla)
Depends on: 1416078
Blocks: 1416078
No longer depends on: 1416078
No longer blocks: 1416078
Severity: normal → critical
Keywords: crash
See Also: → 1356673
Summary: Calling fork() during shutdown on Mac leads to a crash → Calling fork() during shutdown on Mac leads to a crash due to memory allocations
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.
Flags: needinfo?(mh+mozilla)
Type: enhancement → defect
Priority: -- → P3

Hi gabriele, we are checking on really old bugs trying to find what can be closed either because of old functionality or something that has been fixed already on latest versions. I would like to know if this bug is still happening or is there any newer crash report link?
should we keep it open?


Flags: needinfo?(gsvelto)

The bug is still valid, we just avoid using fork() on macOS. Feel free to close this given we simply try to avoid triggering this bug in new code.

Flags: needinfo?(gsvelto)

per last comment, changing bug to resolved WFM

Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.