Aborting from core/sync/mutex.d(147) Error: pthread_mutex_init failed.

mitchell mitchelldlarson at pm.me
Wed Apr 1 02:08:09 UTC 2020


Hello,

I've just finished migrating a project from GDC/Makefile to LDC 
with dub. The program now compiles and runs, and works fine until 
such time as the following error occurs:

Aborting from core/sync/mutex.d(147) Error: pthread_mutex_init 
failed.

out of GDB, the whole text is:

Aborting from core/sync/mutex.d(147) Error: pthread_mutex_init 
failed.
Thread 1 "squares" received signal SIGABRT, Aborted.
[Switching to Thread 0x7ffff74a7580 (LWP 7576)]
__GI_raise (sig=sig at entry=6) at 
../sysdeps/unix/sysv/linux/raise.c:50
50	../sysdeps/unix/sysv/linux/raise.c: No such file or directory.

and the backtrace is (sorry for info dump):

#0  __GI_raise (sig=sig at entry=6) at 
../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007ffff76eb535 in __GI_abort () at abort.c:79
#2  0x00007ffff7ac4fa7 in 
_D4core8internal5abortQgFNbNiNfMAyaMQemZv ()
    from /lib/x86_64-linux-gnu/libdruntime-ldc-shared.so.82
#3  0x00007ffff7acd7e3 in core.sync.mutex.Mutex.~this() ()
    from /lib/x86_64-linux-gnu/libdruntime-ldc-shared.so.82
#4  0x00007ffff7af12ae in rt_finalize2 () from 
/lib/x86_64-linux-gnu/libdruntime-ldc-shared.so.82
#5  0x00007ffff7adb7bf in 
_D2gc4impl12conservativeQw3Gcx5sweepMFNbZm ()
    from /lib/x86_64-linux-gnu/libdruntime-ldc-shared.so.82
#6  0x00007ffff7ad89b2 in 
_D2gc4impl12conservativeQw3Gcx11fullcollectMFNbbZm ()
    from /lib/x86_64-linux-gnu/libdruntime-ldc-shared.so.82
#7  0x00007ffff7ada126 in 
_D2gc4impl12conservativeQw3Gcx10smallAllocMFNbhKmkZPv ()
    from /lib/x86_64-linux-gnu/libdruntime-ldc-shared.so.82
#8  0x00007ffff7ad6c44 in 
_D2gc4impl12conservativeQw14ConservativeGC__T9runLockedS_DQCeQCeQCcQCnQBs12mallocNoSyncMFNbmkKmxC8TypeInfoZPvS_DQEgQEgQEeQEp10mallocTimelS_DQFiQFiQFgQFr10numMallocslTmTkTmTxQCzZQFcMFNbKmKkKmKxQDsZQDl () from /lib/x86_64-linux-gnu/libdruntime-ldc-shared.so.82
#9  0x00007ffff7ad92df in 
_DThn16_2gc4impl12conservativeQw14ConservativeGC6qallocMFNbmkxC8TypeInfoZS4core6memory8BlkInfo_ () from /lib/x86_64-linux-gnu/libdruntime-ldc-shared.so.82
#10 0x00007ffff7addbd0 in gc_qalloc () from 
/lib/x86_64-linux-gnu/libdruntime-ldc-shared.so.82
#11 0x00007ffff7ac9fb2 in 
_D4core6memory2GC6qallocFNaNbmkxC8TypeInfoZSQBqQBo8BlkInfo_ ()
    from /lib/x86_64-linux-gnu/libdruntime-ldc-shared.so.82
#12 0x00007ffff7af0519 in _d_newarrayU () from 
/lib/x86_64-linux-gnu/libdruntime-ldc-shared.so.82
#13 0x00005555556b9682 in 
_D7squares4core5coord5Coord9adjacentsMxFNdZASQBrQBmQBkQBh 
(this=...)
     at 
/home/mitchell/Apps/D/games/squares/src/squares/core/coord.d:102

There are several frames above #13 here, but #13 is the last line 
of "my" code, and the deeper ones (appear?) to be runtime and 
phobos stuff.The lines immediately around coord.d:102 are:

     Coord[] adjacents() const @property
     {
         return [ right, up, left, down ]; // line 102
     }

which are defined in a struct called "Coord". I suspect that 
there isn't something wrong specifically with this line, and 
instead something more "amazingly" wrong. Given that this worked 
fine with the previous (and older) version of GDC which I used 
before my migration, I don't know what could be wrong.

I'm just not entirely certain where to start looking for 
problems. If this issue is over-broad, I'm sorry. Elsewhere in 
the program, I make use of the core.thread and Thread things, 
however that implementation seems fairly straightforward and 
fine, and never had issues under the old compiler.

Any and all help is appreciated!



More information about the Digitalmars-d-learn mailing list