Invoking writeln() from a lot of threads running concurrently --> crash
IM
3di at gm.com
Sat Dec 9 09:38:05 UTC 2017
For purposes of debugging, I'm using writeln() to print stuff out
from tasks running concurrently on many threads. At some point it
crashes with the following stack trace:
Thread 4 received signal SIGUSR1, User defined signal 1.
[Switching to Thread 0x7ffff5ec2700 (LWP 19267)]
__lll_lock_wait_private () at
../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
95 ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S: No such file
or directory.
(gdb) bt
#0 __lll_lock_wait_private () at
../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95
#1 0x00007ffff7bcb2d5 in __flockfile (stream=0x7ffff728b780
<_IO_stdfile_1_lock>) at ../sysdeps/pthread/flockfile.c:28
#2 0x000000000045f5b0 in
_D3std5stdio4File17LockingTextWriter6__ctorMFNcNeKSQBxQBwQBtZSQCiQChQCeQCc ()
#3 0x000000000045f670 in
_D3std5stdio4File17lockingTextWriterMFNfZSQBoQBnQBk17LockingTextWriter ()
#4 0x000000000044a1e0 in
_D3std5stdio4File__T5writeTAyaTyiTaZQqMFNfQpyiaZv (this=...,
_param_2=10 '\n', _param_1=12, _param_0=...)
at /usr/include/dmd/phobos/std/stdio.d:1399
Note that I didn't add any synchronizations around the writeln()
calls, should I? I assume the implementation *should* synchronize
access to std_out, no?
Bug in phobos?
More information about the Digitalmars-d
mailing list