[Issue 19265] New: Multiple calls to rt_init/rt_term leads to SIGILL in _d_initMonoTime

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Sep 25 20:43:55 UTC 2018


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

          Issue ID: 19265
           Summary: Multiple calls to rt_init/rt_term leads to SIGILL in
                    _d_initMonoTime
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: chalucha at gmail.com

I'm playing with fork() with druntime initialized after the fork, but I found
that I can't call rt_init/rt_term to cleanup the runtime multiple times.

Simple test case:

extern extern(C) int _d_run_main(int, char**, void*);
extern (C) int rt_init();
extern (C) int rt_term();

extern(C) int main(int argc, char** argv)
{
        auto res = _d_run_main(argc, argv, &testmain);
        res = _d_run_main(argc, argv, &testmain);
        return res;
}

int testmain(string[] args)
{
        return 1;
}

Backtrace:
#0  0x00000000004327af in _d_initMonoTime ()
#1  0x000000000042a553 in rt_init ()
#2  0x0000000000427c50 in rt.dmain2._d_run_main(int, char**, extern(C)
int(char[][]) function).runAll() ()
#3  0x0000000000427be8 in rt.dmain2._d_run_main(int, char**, extern(C)
int(char[][]) function).tryExec(scope void() delegate) ()
#4  0x0000000000427b50 in _d_run_main ()
#5  0x0000000000427896 in main ()

Is this the expected behavior?

I guess that the problem is at least here:
https://github.com/dlang/druntime/blob/8fd52019826259dc92ab712f4b37a3f0ea4d8265/src/core/time.d#L2514

Tried with dmd-2.082.0

--


More information about the Digitalmars-d-bugs mailing list