[Issue 6880] New: Heisenbug: deferred crash when writing to stdout on Windows without console.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 2 06:43:18 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6880

           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
        AssignedTo: nobody at puremagic.com
        ReportedBy: verylonglogin.reg at gmail.com


--- Comment #0 from Denis <verylonglogin.reg at gmail.com> 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
DEBUG OUTPUT, USE ... INSTEAD".

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
System.IO.Console.WriteLine()...
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.

And
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: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list