[Issue 20227] "Aborting from src/core/sync/event.d(141) Error: pthread_mutex_destroy failed." after fork()

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 18 20:42:58 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20227

Rainer Schuetze <r.sagitario at gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario at gmx.de

--- Comment #1 from Rainer Schuetze <r.sagitario at gmx.de> ---
> 1. GC creates worker threads
> 2. Program forks, leaving the worker threads behind
> 3. The GC keeps working, though, without any worker threads to read
> from its queue, it does all the work in the main thread

That's about what I expected to happen. If the parent process hasn't started
any collection, the fork will create its own set of scan threads.

> 4. On exit, the GC fails to destroy thread-related resources as
> it is not aware that the program has forked.

I didn't think of this. I wonder why the existing tests (e.g. in std.stdio)
didn't fail, maybe because they didn't start any collection before forking.

I guess what needs to happen is to reinitialize thread handles and used mutices
in an atfork child handler.

--


More information about the Digitalmars-d-bugs mailing list