www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5537] New: invariant._d_invariant() failing in std.concurrency.MessageBox.get

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: jmdavisProg gmx.com



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



tid)).get (this=0x0, _param_1=579319349254397504, _param_0=10000) at
/home/jmdavis/dmd2/linux/bin/../../src/phobos/std/concurrency.d:716

tid)).receiveTimeout (_param_1=579319349254397504, ms=1) at
/home/jmdavis/dmd2/linux/bin/../../src/phobos/std/concurrency.d:501







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: -------
Feb 06 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5537




PST ---
Using git-bisect, I have confirmed that it is this commit to Phobos which broke
it:

https://github.com/D-Programming-Language/phobos/commit/ecc7390670a122dec11183cbefbef2e7d9477921

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 14 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5537


Jonathan M Davis <jmdavisProg gmx.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



PST ---
This no longer segfaults, so I assume that the issue has been fixed.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jan 20 2012