[Issue 6135] New: Thread/GC interaction bug on OS X

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jun 9 13:41:15 PDT 2011


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

           Summary: Thread/GC interaction bug on OS X
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Mac OS X
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: code at klickverbot.at


--- Comment #0 from klickverbot <code at klickverbot.at> 2011-06-09 13:36:40 PDT ---
Consider the following program:
---
import core.memory;
import core.thread;

void doNothing() {}

void main() {
  foreach (i; 0 .. 10000) {
    auto t = new Thread(&doNothing);
    t.start();
    GC.collect();
  }
}
---

With latest DMD (9aae5c4) and druntime (00ce4ab) on OS X, this triggers the
"Unable to load thread state" clause at core/thread.d:2280 during a GC
collection (which in turn triggers an onOutOfMemoryError() on allocating the
exception object because it happens during a GC runs, which accounts for #0-#5
in the backtrace below): 
---
#0  0x00012787 in _d_throwc ()
#1  0x00009686 in onOutOfMemoryError ()
#2  0x0000e8b9 in D2gc3gcx2GC12mallocNoSyncMFkkPkZPv ()
#3  0x0000e855 in D2gc3gcx2GC6mallocMFkkPkZPv ()
#4  0x0000dc58 in gc_malloc ()
#5  0x000134bb in _d_newclass ()
#6  0x0000b558 in
D4core6thread17thread_suspendAllUZv7suspendMFC4core6thread6ThreadZv ()
#7  0x0000b447 in thread_suspendAll ()
#8  0x00010b75 in D2gc3gcx3Gcx11fullcollectMFPvZk ()
#9  0x00010b2d in D2gc3gcx3Gcx16fullcollectshellMFZk ()
#10 0x0000faf7 in D2gc3gcx2GC11fullCollectMFZk ()
#11 0x0000da59 in gc_collect ()
#12 0x000096bb in D4core6memory2GC7collectFZv ()
#13 0x000027ea in _Dmain ()
#14 0x000132df in D2rt6dmain24mainUiPPaZi7runMainMFZv ()
#15 0x00012e89 in D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv ()
#16 0x00013327 in D2rt6dmain24mainUiPPaZi6runAllMFZv ()
#17 0x00012e89 in D2rt6dmain24mainUiPPaZi7tryExecMFMDFZvZv ()
#18 0x00012e23 in main ()
---

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


More information about the Digitalmars-d-bugs mailing list