www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2405] New: std.gc.fullCollect hangs with multiple threads.

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2405

           Summary: std.gc.fullCollect hangs with multiple threads.
           Product: D
           Version: 2.019
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: critical
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: ludwig informatik.uni-luebeck.de


A bit difficult to debug using the existing debuggers - but when another
background thread is active in addition to the main thread, the main thread
seems to pause or deadlock itself when fullCollect is called (implicitly or
explicitly). This makes threaded programming almost impossible atm and is a
complete blocker for me.

This is a regression from 2.018. Not tested on Linux.

The following test code reproduces the problem 100% of the time on my dual-core
system:
---
import std.gc;
import std.stdio;
import std.thread;
import std.c.windows.windows;

int main()
{
        (new Thread(delegate int(){
                Sleep(500); // simulate some work
                return 0;
        })).start();

        writeln("Running fullCollect..");
        std.gc.fullCollect();
        writeln(".. done");

        assert(false, "Did not hang!");

        return 0;
}
---


The stack trace for the main thread looks like this during the hang:
---








---

Sidenote:
There seems to be another issue with concurrent allocations/frees which has
proven itself to be hard to reproduce in a testcase (might be
http://d.puremagic.com/issues/show_bug.cgi?id=1957).


-- 
Oct 09 2008
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2405






-------
*** Bug 2404 has been marked as a duplicate of this bug. ***


-- 
Oct 21 2008
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=2405


ludwig informatik.uni-luebeck.de changed:

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





-------
Fixed with the switch to druntime.


-- 
Oct 21 2008