digitalmars.D.bugs - [Issue 20271] New: Handle forking in the GC
- d-bugmail puremagic.com (42/42) Oct 06 2019 https://issues.dlang.org/show_bug.cgi?id=20271
https://issues.dlang.org/show_bug.cgi?id=20271 Issue ID: 20271 Summary: Handle forking in the GC Product: D Version: D2 Hardware: x86_64 OS: Linux Status: NEW Severity: normal Priority: P1 Component: druntime Assignee: nobody puremagic.com Reporter: dlang-bugzilla thecybershadow.net This problem currently never finishes execution: ////////////// test2817a.d ////////////// import core.stdc.stdlib : exit; import core.sys.posix.sys.wait : waitpid; import core.sys.posix.unistd : fork; import core.thread : Thread; void main() { foreach (t; 0 .. 10) new Thread({ foreach (n; 0 .. 100) { foreach (x; 0 .. 100) new ubyte[x]; auto f = fork(); assert(f >= 0); if (f == 0) exit(0); else waitpid(f, null, 0); } }).start(); } ///////////////////////////////////////// Here the exit function (not _exit) calls finalizers, which includes shutting down the GC. However, if the GC lock was being held while a fork happened, that leaves the GC in an inconsistent state in the fork. PR: https://github.com/dlang/druntime/pull/2817 --
Oct 06 2019