Thread overview
[Issue 2890] New: std.stdio.write family blocks on file lock
Apr 25, 2009
d-bugmail
Apr 25, 2009
d-bugmail
May 01, 2009
d-bugmail
May 15, 2009
Walter Bright
April 25, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2890

           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
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: graham.stjack@internode.on.net


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;


-- 

April 25, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2890





------- Comment #1 from graham.stjack@internode.on.net  2009-04-24 19:19 -------
Created an attachment (id=339)
 --> (http://d.puremagic.com/issues/attachment.cgi?id=339&action=view)
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.


-- 

May 01, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2890


dsimcha@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dsimcha@yahoo.com




------- Comment #2 from dsimcha@yahoo.com  2009-04-30 19:24 -------
*** Bug 2907 has been marked as a duplicate of this bug. ***


-- 

May 15, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2890


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




--- Comment #3 from Walter Bright <bugzilla@digitalmars.com>  2009-05-15 12:19:25 PDT ---
Fixed dmd 2.030

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------