druntime master (2024ca6d3e29362a2fc84ef51c0f73316259d645) dmd master (15b68997d0ae2332ed653658e5d7643fcf0d354f) $ dmd-git -main -unittest -g src/core/thread.d $ ./thread core.exception.AssertError@src/core/thread.d(1652): Assertion failure ---------------- ./thread() [0x427dec] ./thread(nothrow void core.thread.Thread.remove(core.thread.Thread.Context*)+0x3a) [0x421f3a] ./thread(nothrow void core.thread.Thread.remove(core.thread.Thread)+0x6e) [0x4220fe] ./thread(thread_detachInstance+0x15) [0x422845] ./thread(void core.thread.__unittestL2143_6()+0x44) [0x42288c] ./thread(void core.thread.__modtest()+0x22) [0x427d4a] ./thread(int core.runtime.runModuleUnitTests().__foreachbody3(object.ModuleInfo*)+0x34) [0x432690] ./thread(int object.ModuleInfo.opApply(scope int delegate(object.ModuleInfo*)).__lambda2(immutable(object.ModuleInfo*))+0x1c) [0x4299e0] ./thread(int rt.minfo.moduleinfos_apply(scope int delegate(immutable(object.ModuleInfo*))).__foreachbody2(ref rt.sections_linux.DSO)+0x47) [0x42f957] ./thread(int rt.sections_linux.DSO.opApply(scope int delegate(ref rt.sections_linux.DSO))+0x42) [0x42fb0a] ./thread(int rt.minfo.moduleinfos_apply(scope int delegate(immutable(object.ModuleInfo*)))+0x25) [0x42f8ed] ./thread(int object.ModuleInfo.opApply(scope int delegate(object.ModuleInfo*))+0x25) [0x4299b9] ./thread(runModuleUnitTests+0xa8) [0x432524] ./thread(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).runAll()+0x17) [0x42d1e3] ./thread(void rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).tryExec(scope void delegate())+0x2a) [0x42d196] ./thread(_d_run_main+0x1dc) [0x42d110] ./thread(main+0x25) [0x427e4d] At the same time running `make -f posix.mak unittest` works (and core.thread is mentioned in list of tested modules) This can be something related to my system as I have been having bunch of threading related issues in several other projects no one else can reproduce. OS: Arch Linux x64 glibc 2.20 kernel 3.16.4
If I simply disable the assertion resulting test program hangs here: #0 0x00007ffff7bcd910 in sem_wait () from /usr/lib/libpthread.so.0 #1 0x0000000000422ba0 in core.thread.suspend(core.thread.Thread) (t=0x7ffff7ec5700) at src/core/thread.d:2490 #2 0x0000000000422d45 in thread_suspendAll () at src/core/thread.d:2577 #3 0x0000000000423677 in core.thread.__unittestL2949_15() () at src/core/thread.d:2974 #4 0x0000000000427d41 in core.thread.__modtest() () #5 0x0000000000432678 in core.runtime.runModuleUnitTests().__foreachbody3(object.ModuleInfo*) () #6 0x00000000004299c8 in object.ModuleInfo.opApply(scope int(object.ModuleInfo*) delegate).__lambda2(immutable(object.ModuleInfo*)) () #7 0x000000000042f93f in rt.minfo.moduleinfos_apply(scope int(immutable(object.ModuleInfo*)) delegate).__foreachbody2(ref rt.sections_linux.DSO) () #8 0x000000000042faf2 in rt.sections_linux.DSO.opApply(scope int(ref rt.sections_linux.DSO) delegate) () #9 0x000000000042f8d5 in rt.minfo.moduleinfos_apply(scope int(immutable(object.ModuleInfo*)) delegate) () #10 0x00000000004299a1 in object.ModuleInfo.opApply(scope int(object.ModuleInfo*) delegate) () #11 0x000000000043250c in runModuleUnitTests () #12 0x000000000042d1cb in rt.dmain2._d_run_main(int, char**, extern(C) int(char[][]) function*).runAll() () #13 0x000000000042d17e in rt.dmain2._d_run_main(int, char**, extern(C) int(char[][]) function*).tryExec(scope void() delegate) () #14 0x000000000042d0f8 in _d_run_main () #15 0x0000000000427e35 in main () #16 0x00007ffff732f040 in __libc_start_main () from /usr/lib/libc.so.6 #17 0x0000000000420629 in _start ()
It was discovered that deadlock issue was because of GDM bug. Updating it to 3.14.1 did take care of the problem (see also https://issues.dlang.org/show_bug.cgi?id=4890) Assertion still fires though. It looks like it only works in combined test suite because other threads happen to be created before this test is run.
See PR, which has been merged. https://github.com/dlang/druntime/pull/1016