On Wednesday, 18 February 2015 at 21:21:11 UTC, Byron Heads wrote:
On Wednesday, 18 February 2015 at 21:05:10 UTC, Byron Heads wrote:
On Wednesday, 18 February 2015 at 20:55:56 UTC, ketmar wrote:
On Wed, 18 Feb 2015 20:35:44 +0000, Byron Heads wrote:

On Wednesday, 18 February 2015 at 20:33:40 UTC, ketmar wrote:
On Wed, 18 Feb 2015 20:27:07 +0000, Byron Heads wrote:

are you forking? ;-)


I am in the daemonize library

https://github.com/NCrashed/daemonize

can you drop that and just let the program run on foreground? i suspect that it may solve your problem. you can detach your program with "setsid"
and "&" to avoid forking.

`fork()` is a very fragile thing, and it may be the source of heisenbugs. stop `fork()`ing may be the easiest solution (if it solves something, of
course ;-).

By passing daemonize with the GC enabled is working.. going to dig into the signals and see if thats it.



My guess is this is going to be related to forking, going to see if I can make a test case.


Now I am not sure. This code runs correctly:

import std.stdio;
import std.concurrency;
import core.sys.posix.unistd;
import core.sys.posix.sys.stat;
import core.memory;
import std.c.linux.linux;

extern(C) nothrow {
        int __libc_current_sigrtmin();
        int close(int rd);
}

void  foo(Tid tid) {
        writeln("1");
        foreach(i; 0..1024) {
                ubyte[] buffer = new ubyte[](8_192);
                auto f = new float[1024];
                GC.collect;
        }

        writeln("2");

        send(tid, true);
        
}

extern(C) void sigsig(int sig) nothrow pure @system @nogc {

}



void main() {
        auto pid = fork();
        if(pid < 0) {
                writeln("fork failed");
        } if (pid > 0) {
                writeln("Spawned ", pid);
                return;
        }
        
        umask(0);
        auto sid = setsid();
        if(sid < 0) {
                writeln("failed to set sid");
        }

        assert(signal(SIGABRT, &sigsig) != SIG_ERR);
        assert(signal(SIGTERM, &sigsig) != SIG_ERR);
        assert(signal(SIGQUIT, &sigsig) != SIG_ERR);
        assert(signal(SIGINT, &sigsig) != SIG_ERR);
        assert(signal(SIGQUIT, &sigsig) != SIG_ERR);
        assert(signal(SIGHUP, &sigsig) != SIG_ERR);
        assert(signal(__libc_current_sigrtmin+1, &sigsig) != SIG_ERR);

        writeln("spawning");
        spawn(&foo, thisTid);
        spawn(&foo, thisTid);
        spawn(&foo, thisTid);

        foreach(i; 0..1024) {
                auto x = new long[1024];
                GC.collect;
        }

        receiveOnly!bool;
        receiveOnly!bool;
        receiveOnly!bool;

        GC.collect;
        writeln("done");
}



  • GC deadlocks on linux Byron Heads via Digitalmars-d-learn
    • Re: GC deadlocks on linu... ketmar via Digitalmars-d-learn
      • Re: GC deadlocks on ... Byron Heads via Digitalmars-d-learn
        • Re: GC deadlocks... ketmar via Digitalmars-d-learn
          • Re: GC deadl... Byron Heads via Digitalmars-d-learn
            • Re: GC ... Byron Heads via Digitalmars-d-learn
              • Re:... Byron Heads via Digitalmars-d-learn
              • Re:... ketmar via Digitalmars-d-learn
              • Re:... ketmar via Digitalmars-d-learn
              • Re:... Byron Heads via Digitalmars-d-learn
                • ... ketmar via Digitalmars-d-learn
                • ... Steven Schveighoffer via Digitalmars-d-learn
                • ... ketmar via Digitalmars-d-learn
                • ... via Digitalmars-d-learn
                • ... ketmar via Digitalmars-d-learn
                • ... via Digitalmars-d-learn
                • ... ketmar via Digitalmars-d-learn
                • ... Kagamin via Digitalmars-d-learn
                • ... via Digitalmars-d-learn
                • ... ketmar via Digitalmars-d-learn

Reply via email to