GC hangs on spinlock in ConservativeGC.runLocked

klasbo klasbo at gmail.com
Mon Feb 20 13:01:43 UTC 2023


This is in a vibe.d application, on Ubuntu server 22.04. 
Presumably something isn't unlocking the gcLock, but I have no 
idea what. See GDB backtrace below.

Ideas? And is there some way to get stack traces for any other 
vibe-tasks in a running process? Could this be caused by a 
non-clean exit of a vibe task?

It's hard to know if this is me, vibe.d, or druntime...

```
#0  0x00007f7d13573868 in __GI___clock_nanosleep 
(clock_id=clock_id at entry=0, flags=flags at entry=0, 
req=0x7f7d0e6763d0, rem=0x7f7d0e6763e0)
     at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:78
#1  0x00007f7d135786e7 in __GI___nanosleep (req=<optimized out>, 
rem=<optimized out>) at ../sysdeps/unix/sysv/linux/nanosleep.c:25
#2  0x000055c709ddca40 in 
core.thread.osthread.Thread.sleep(core.time.Duration) ()
#3  0x000055c709e7db08 in 
core.internal.spinlock.SpinLock.yield(ulong) shared ()
#4  0x000055c709e7dab2 in core.internal.spinlock.SpinLock.lock() 
shared ()
#5  0x000055c709e86dff in 
core.internal.gc.impl.conservative.gc.ConservativeGC.runLocked!(core.internal.gc.impl.conservative.gc.ConservativeGC.mallocNoSync(ulong, uint, ref ulong, const(TypeInfo)), core.internal.gc.impl.conservative.gc.mallocTime, core.internal.gc.impl.conservative.gc.numMallocs, ulong, uint, ulong, const(TypeInfo)).runLocked(ref ulong, ref uint, ref ulong, ref const(TypeInfo)) ()
#6  0x000055c709e7e776 in 
core.internal.gc.impl.conservative.gc.ConservativeGC.malloc(ulong, uint, const(TypeInfo)) ()
#7  0x000055c709dd94bf in gc_malloc ()
#8  0x000055c709de0139 in _d_newclass ()
#9  0x000055c709dd1fe1 in core.runtime.defaultTraceHandler(void*) 
()
#10 0x000055c709dded7e in _d_traceContext ()
#11 0x000055c709e4269e in _d_createTrace ()
#12 0x000055c709ddf45e in _d_throwdwarf ()
#13 0x000055c709e83130 in 
core.internal.gc.impl.conservative.gc.Gcx.fullcollect(bool, bool, 
bool) ()
#14 0x000055c709e810fa in 
core.internal.gc.impl.conservative.gc.Gcx.bigAlloc(ulong, ref 
ulong, uint, const(TypeInfo)) ()
#15 0x000055c709e86e52 in 
core.internal.gc.impl.conservative.gc.ConservativeGC.runLocked!(core.internal.gc.impl.conservative.gc.ConservativeGC.mallocNoSync(ulong, uint, ref ulong, const(TypeInfo)), core.internal.gc.impl.conservative.gc.mallocTime, core.internal.gc.impl.conservative.gc.numMallocs, ulong, uint, ulong, const(TypeInfo)).runLocked(ref ulong, ref uint, ref ulong, ref const(TypeInfo)) ()
#16 0x000055c709e7e8d2 in 
core.internal.gc.impl.conservative.gc.ConservativeGC.qalloc(ulong, uint, scope const(TypeInfo)) ()
#17 0x000055c709dd9503 in gc_qalloc ()
#18 0x000055c709ad8694 in 
_D3std5array__T8AppenderTAyaZQo13ensureAddableMFmZ9__lambda9MFNaNbNeZS4core6memory8BlkInfo_ (__capture=0x7f7d0e676a90, __HID4=0x7f7d0e676a60)
     at 
/usr/local/dlang/dmd-2.100.2/linux/bin64/../../src/phobos/std/array.d:3576
[rest of trace omitted]
```


More information about the Digitalmars-d mailing list