Bug 18052 – LockingTextWriter is not thread safe

Status
RESOLVED
Resolution
INVALID
Severity
major
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-12-10T01:11:02Z
Last change time
2018-04-02T12:58:12Z
Assigned to
No Owner
Creator
Walter Bright
See also
https://issues.dlang.org/show_bug.cgi?id=13727, https://issues.dlang.org/show_bug.cgi?id=15768

Comments

Comment #0 by bugzilla — 2017-12-10T01:11:02Z
IM writes: 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?
Comment #1 by bugzilla — 2017-12-10T01:24:35Z
Comment #2 by jack — 2018-04-02T12:58:12Z