Summary: Heisenbug: deferred crash when writing to stdout on
                    Windows without console.
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos

--- Comment #0 from Denis <> 2011-11-02 16:42:48 MSK 
A possible Release-only bug: deferred crash when writing to stdout on Windows
without console.

To reproduce:
1. Write a program using `writeln` for debugging output.
2. Prefix every `writeln` with a `debug` except one which was missed.
3. Create a release build with SUBSYSTEM:WINDOWS which has no console and test
it a bit to see it launches and works.
4. Take tons of user feedbacks like: "It works about a minute (10 minues, an
hour) and than it crashes."

Fitst two Steps will be solved as soon as
Suggestion #1. some debug tracing will be added to Phobos (std.log, e.g.) and
Suggestion #2. `writeln` with friends will be marked by a big red text "NOT FOR

But it still can be a situation like when you need an optional non-debug
console output for some reason, e.g. program can optionally work in a console
mode and than you have missed one `if(consoleMode)` prefix.

Suggestion #3. Throw an exception as soon as `writeln` is called and standard
output stream is invalid, like .NET Framework's
Strange, but I can't reproduce such exception in .NET Framework any more, now
WriteLine() just silently doing nothing, maybe I mixed something in memory, it
was a long time ago... Anyway, this silence looks not good.

Suggestion #4. Remove writing debug info to a console in release from Phobos
(e.g. std.typecons.Unique) and disallow such code in Phobos forever.

But all this is just IMO, what do you think?

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to