Summary: std.stdio.write family blocks on file lock
           Product: D
           Version: 2.029
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: major
          Priority: P2
         Component: Phobos

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
<         //return LockingTextWriter(this);
>         return LockingTextWriter(this);
<         auto result = LockingTextWriter(this);
<         return result;
>         //auto result = LockingTextWriter(this);
>         //return result;


Reply via email to