www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18052] New: LockingTextWriter is not thread safe

https://issues.dlang.org/show_bug.cgi?id=18052

          Issue ID: 18052
           Summary: LockingTextWriter is not thread safe
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: bugzilla digitalmars.com

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

../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95

<_IO_stdfile_1_lock>) at ../sysdeps/pthread/flockfile.c:28

_D3std5stdio4File17LockingTextWriter6__ctorMFNcNeKSQBxQBwQBtZSQCiQChQCeQCc ()

_D3std5stdio4File17lockingTextWriterMFNfZSQBoQBnQBk17LockingTextWriter ()

(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?

--
Dec 09 2017