http://d.puremagic.com/issues/show_bug.cgi?id=5537

           Summary: invariant._d_invariant() failing in
                    std.concurrency.MessageBox.get
           Product: D
           Version: unspecified
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos
        AssignedTo: nob...@puremagic.com
        ReportedBy: jmdavisp...@gmx.com


--- Comment #0 from Jonathan M Davis <jmdavisp...@gmx.com> 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)
                   {
                       writeln(++totalThreads);
                   };

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

        spawn(&threadFunc, thisTid);
    }

    while(currThreads > 0)
        receive(recProc);
}

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
/home/jmdavis/dmd2/linux/bin/../../src/phobos/std/concurrency.d:716
#2  0x080a56aa in std.concurrency.receiveTimeout!(void delegate(Tid
tid)).receiveTimeout (_param_1=579319349254397504, ms=1) at
/home/jmdavis/dmd2/linux/bin/../../src/phobos/std/concurrency.d:501
#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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to