Bug 14003 – fork() on MacOS X 10.10.1 results in a core.exception.InvalidMemoryOperationError@(0)

Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P5
Component
druntime
Product
D
Version
D2
Platform
x86_64
OS
Mac OS X
Creation time
2015-01-18T16:05:28Z
Last change time
2020-01-16T14:26:00Z
Assigned to
No Owner
Creator
Riki
See also
https://issues.dlang.org/show_bug.cgi?id=14205

Comments

Comment #0 by lplus — 2015-01-18T16:05:28Z
// DMD64 D Compiler v2.066.1 on OS X 10.10.1 // results core.exception.InvalidMemoryOperationError@(0) import core.sys.posix.unistd; void main() { fork(); } // ok import core.sys.posix.unistd; extern(C): // ++++ void main() { fork(); } // ok import core.sys.posix.unistd; void main() { if (fork() == 0) { _exit(0); } } // ok import core.sys.posix.unistd; void main() { if (fork() == 0) { // call exec* } } // why ?
Comment #1 by greeenify — 2018-07-02T21:56:11Z
*** Issue 15511 has been marked as a duplicate of this issue. ***
Comment #2 by schveiguy — 2018-07-03T12:49:50Z
It's likely something to do with D RT shutdown, since all the cases that pass do NOT do that. It would be helpful to know where the exception is happening. I almost want to close this as WONTFIX, as forking and treating the process like it's a normal process is really not a valid use case for fork. See http://www.evanjones.ca/fork-is-dangerous.html
Comment #3 by pro.mathias.lang — 2020-01-16T14:26:00Z
Fork works on Mac OSX now.