Thread overview
[Issue 17797] [REG 2.073.2] double print to stdout when reading stdin in another thread
Oct 03, 2017
Walter Bright
Oct 03, 2017
ag0aep6g@gmail.com
Oct 09, 2017
Martin Nowak
Oct 10, 2017
Rainer Schuetze
October 03, 2017
https://issues.dlang.org/show_bug.cgi?id=17797

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com
          Component|dmd                         |phobos
           Hardware|x86                         |All

--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> ---
It happens on Win32 as well, which uses the DMC runtime library, not Microsoft's. So it is not specific to the Microsoft runtime library.

I suspect it is a Phobos problem, not a compiler issue, and changed the category accordingly.

--
October 03, 2017
https://issues.dlang.org/show_bug.cgi?id=17797

ag0aep6g@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ag0aep6g@gmail.com

--- Comment #2 from ag0aep6g@gmail.com ---
(In reply to Walter Bright from comment #1)
> It happens on Win32 as well, which uses the DMC runtime library, not Microsoft's. So it is not specific to the Microsoft runtime library.

It *only* happens with the DMC runtime. People are running 64-bit Windows, but they're not using 64-bit dmd. I just tested in a virtual machine with -m32mscoff and didn't see duplicated lines.

--
October 09, 2017
https://issues.dlang.org/show_bug.cgi?id=17797

Martin Nowak <code@dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code@dawg.eu
           Hardware|All                         |x86

--- Comment #3 from Martin Nowak <code@dawg.eu> ---
cat > bug.d << CODE
import std.stdio, core.thread;

void main()
{
    auto thread = new Thread(&func).start;
    writeln("Output");
    writeln("Output2");
    writeln("Output3");
    thread.join();
}

void func()
{
    foreach (line; stdin.byLineCopy)
    {
    }
}
CODE
dmd -run bug.d
----
Slightly nicer version that terminates on EOF (Ctrl+D), works as expected on
linux.

Sure about 2.073.2? The only interesting change in

https://github.com/dlang/dmd/compare/v2.073.1...v2.073.2 https://github.com/dlang/druntime/compare/v2.073.1...v2.073.2 https://github.com/dlang/phobos/compare/v2.073.1...v2.073.2

is https://github.com/dlang/dmd/pull/6582.

--
October 10, 2017
https://issues.dlang.org/show_bug.cgi?id=17797

Rainer Schuetze <r.sagitario@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |r.sagitario@gmx.de

--- Comment #4 from Rainer Schuetze <r.sagitario@gmx.de> ---
I could verify it happens with 2.073.2, but not 2.073.1. This is caused by an updated snn.lib. Might be introduced by the fix for issue 13727.

--