digitalmars.D - Invoking writeln() from a lot of threads running concurrently -->
- IM (26/26) Dec 09 2017 For purposes of debugging, I'm using writeln() to print stuff out
- Messenger (5/10) Dec 09 2017 Is that a crash or just thread 4 receiving SIGUSR1? (GC signal)
- IM (2/13) Dec 09 2017 Thanks! That works!
- Mengu (3/14) Dec 10 2017 i've been bitten many times by this. thanks to the folks on irc,
- Seb (3/7) Dec 09 2017 Yes, try using synchronized access. IIRC the implementation of
- Walter Bright (5/7) Dec 09 2017 There's no bugzilla issue on this. So I added one:
- IM (8/14) Dec 09 2017 I was going to file one, but I wanted to verify first that it's
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 () _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?
Dec 09 2017
On Saturday, 9 December 2017 at 09:38:05 UTC, IM wrote: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.[...]Bug in phobos?Is that a crash or just thread 4 receiving SIGUSR1? (GC signal) If so you just need to tell gdb not to stop on that. ("handle SIGUR1 SIGUSR2 nostop", place it in ~/.gdbinit)
Dec 09 2017
On Saturday, 9 December 2017 at 10:36:08 UTC, Messenger wrote:On Saturday, 9 December 2017 at 09:38:05 UTC, IM wrote:Thanks! That works!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.[...]Bug in phobos?Is that a crash or just thread 4 receiving SIGUSR1? (GC signal) If so you just need to tell gdb not to stop on that. ("handle SIGUR1 SIGUSR2 nostop", place it in ~/.gdbinit)
Dec 09 2017
On Saturday, 9 December 2017 at 10:36:08 UTC, Messenger wrote:On Saturday, 9 December 2017 at 09:38:05 UTC, IM wrote:i've been bitten many times by this. thanks to the folks on irc, it now lives in gdbinit.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.[...]Bug in phobos?Is that a crash or just thread 4 receiving SIGUSR1? (GC signal) If so you just need to tell gdb not to stop on that. ("handle SIGUR1 SIGUSR2 nostop", place it in ~/.gdbinit)
Dec 10 2017
On Saturday, 9 December 2017 at 09:38:05 UTC, IM wrote: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?Yes, try using synchronized access. IIRC the implementation of LockingTextWriter isn't thread-safe.
Dec 09 2017
On 12/9/2017 5:56 AM, Seb wrote:IIRC the implementation of LockingTextWriter isn't thread-safe.There's no bugzilla issue on this. So I added one: https://issues.dlang.org/show_bug.cgi?id=18052 Please, folks, I can't emphasize this enough. When you find a bug, POST IT ON BUGZILLA! Otherwise, it will NEVER get fixed.
Dec 09 2017
On Sunday, 10 December 2017 at 01:12:37 UTC, Walter Bright wrote:On 12/9/2017 5:56 AM, Seb wrote:I was going to file one, but I wanted to verify first that it's seem to be one if SIGUSR1 is a GC signal. I was trying to debug a crash in gdb and that one kept showing up. After adding handle SIGUSR1 SIGUSR2 nostop I was able to capture the real issue. Sorry for the false positive --- still learning about D! :( I think we can probably close that bug.IIRC the implementation of LockingTextWriter isn't thread-safe.There's no bugzilla issue on this. So I added one: https://issues.dlang.org/show_bug.cgi?id=18052 Please, folks, I can't emphasize this enough. When you find a bug, POST IT ON BUGZILLA! Otherwise, it will NEVER get fixed.
Dec 09 2017