Bug 2890 – std.stdio.write family blocks on file lock

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-04-24T19:15:00Z
Last change time
2015-06-09T01:26:27Z
Assigned to
bugzilla
Creator
graham.stjack

Attachments

IDFilenameSummaryContent-TypeSize
339net_test.dA test-casetext/x-dsrc3628

Comments

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. ***
Comment #3 by bugzilla — 2009-05-15T12:19:25Z
Fixed dmd 2.030