Comment #0 by graham.stjack — 2009-04-24T19:15:23Z
In multi-threaded applications, File.LockingTextWriter is not correctly locking/unlocking the underlying FILE* handle, resulting in deadlocks. The more trace prints you put in to find the problem, the worse it gets.
The problem seems to be related to recent dmd bug-fixes, and I worked around it with the following change. It looks like LockingTextWriter needs to be revisited, maybe by reinstating the non-hacked implementation.
$ diff dmd/src/phobos/std/stdio.d stdio.d
922c922
< //return LockingTextWriter(this);
---
> return LockingTextWriter(this);
925,926c925,926
< auto result = LockingTextWriter(this);
< return result;
---
> //auto result = LockingTextWriter(this);
> //return result;
Comment #1 by graham.stjack — 2009-04-24T19:19:28Z
Created attachment 339
A test-case
This is more complicated than it needs to be, but I already had it lying about for another bug report. If deadlocks at various points using dmd 2.029, but when I modify std.stdio as described in the bug report, it works every time.
Comment #2 by dsimcha — 2009-04-30T19:24:46Z
*** Bug 2907 has been marked as a duplicate of this bug. ***