www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 19978] New: D sometimes just crashes on exit with daemon

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

          Issue ID: 19978
           Summary: D sometimes just crashes on exit with daemon threads
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: default_357-line yahoo.de

Consider the following code:

void main()
{
    import core.thread : Thread;

    with (new Thread({ })) { isDaemon = true; start; }
}

On Linux, this builds and runs successfully, maybe 99% of the time.

But if you run it in a loop:

while true; do ./test || break; done

You will see that it segfaults after a few seconds.

I asked the forum for repros (
https://forum.dlang.org/post/awnslgsogmdixktynjmw forum.dlang.org ), and got
successful crashes on these systems:

- DMD 2.080.0, Linux 4.18.0-20 x86_64

- DMD 2.086.0, Linux 5.0.0-16-generic x86_64



- LDC2-1.11, Linux 4.14.111

- DMD64 2.086.0, MacOs 10.13.6; Darwin Kernel Version 17.7.0; x86_64

and a failure to reproduce under Windows 10, dmd 2.082.0 and ldc2 1.12.0-beta2.

The crashes on MacOs and LDC, effectively excluding backend issues and kernel
bugs, strongly hint at a druntime bug.

See the forum thread for some backtraces.

--
Jun 16 2019