Summary: invariant._d_invariant() failing in
           Product: D
           Version: unspecified
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos

--- Comment #0 from Jonathan M Davis <> 2011-02-06 20:32:06 
PST ---
This program currently results in a segfault:

import std.concurrency;
import std.stdio;

void main()
    int currThreads = 0;
    enum maxThreads = 6;

    size_t totalThreads = 0;
    auto recProc = (Tid tid)

    for(size_t i = 0; i < 1_000; ++i)
        if(currThreads < maxThreads)
            receiveTimeout(1, recProc);

        spawn(&threadFunc, thisTid);

    while(currThreads > 0)

void threadFunc(Tid parentTid)
    send(parentTid, thisTid);

This is using the latest versions of druntime and phobos from git. The stack
trace I get with gdb is

#0  0x080ade03 in invariant._d_invariant() ()
#1  0x080a56cc in std.concurrency.MessageBox.get!(long,void delegate(Tid
tid)).get (this=0x0, _param_1=579319349254397504, _param_0=10000) at
#2  0x080a56aa in std.concurrency.receiveTimeout!(void delegate(Tid
tid)).receiveTimeout (_param_1=579319349254397504, ms=1) at
#3  0x080a27a5 in D main () at l.d:18
#4  0x080add86 in rt.dmain2.main() ()
#5  0x080add18 in rt.dmain2.main() ()
#6  0x080addca in rt.dmain2.main() ()
#7  0x080add18 in rt.dmain2.main() ()
#8  0x080adcc4 in main ()

If I simplify the program that it uses only receive and not receiveTimeout, it
still fails, so it's not an issue specific to receiveTimeout. I have also
confirmed that the check-in 94bd4f661be79db34faedf76ca139115a07a9dd3 (Issue
4307 - spawn()'ed thread doesn't terminate) didn't cause the problem.

I have no idea what invariant._d_invariant() is - std.concurrency doesn't have
any invariants in it - but this bug makes spawn utterly useless.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to