www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17413] New: Deadlock if allocation fails during runtime

https://issues.dlang.org/show_bug.cgi?id=17413

          Issue ID: 17413
           Summary: Deadlock if allocation fails during runtime
                    initialization
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: minor
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: thecybershadow gmail.com

$ echo 'void main() {}' > test.d
$ dmd test.d
$ ( ulimit -v 16384 ; ./test )

(hangs)

Attaching with gdb shows the following stack trace:

Thread 1 (Thread 0x7fab23098840 (LWP 31767)):
#0  0x00007fab22ca9296 in do_futex_wait.constprop () from
/usr/lib/libpthread.so.0
#1  0x00007fab22ca9354 in __new_sem_wait_slow.constprop.0 () from
/usr/lib/libpthread.so.0
#2  0x0000000000443b09 in thread_suspendAll ()
#3  0x0000000000435359 in gc.impl.conservative.gc.Gcx.fullcollect(bool) ()
#4  0x00000000004333c6 in gc.impl.conservative.gc.Gcx.smallAlloc(ubyte, ref
ulong, uint) ()
#5  0x0000000000437607 in
gc.impl.conservative.gc.ConservativeGC.runLocked!(gc.impl.conservative.gc.ConservativeGC.mallocNoSync(ulong,
uint, ref ulong, const(TypeInfo)), gc.impl.conservative.gc.mallocTime,
gc.impl.conservative.gc.numMallocs, ulong, uint, ulong,
const(TypeInfo)).runLocked(ref ulong, ref uint, ref ulong, ref const(TypeInfo))
()
#6  0x0000000000430eea in gc.impl.conservative.gc.ConservativeGC.malloc(ulong,
uint, const(TypeInfo)) ()
#7  0x00000000004302c0 in gc_malloc ()
#8  0x0000000000439107 in _d_newclass ()
#9  0x00000000004438fc in thread_attachThis ()
#10 0x0000000000443826 in thread_init ()
#11 0x00000000004301cf in gc_init ()
#12 0x000000000042950b in rt_init ()
#13 0x000000000042718e in _D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ6runAllMFNlZv
()
#14 0x0000000000427135 in
_D2rt6dmain211_d_run_mainUiPPaPUAAaZiZ7tryExecMFNlMDFZvZv ()
#15 0x00000000004270af in _d_run_main ()
#16 0x0000000000426ede in main ()
#17 0x00007fab21fdf511 in __libc_start_main () from /usr/lib/libc.so.6
#18 0x0000000000426dfa in _start ()

--
May 19