www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: verylonglogin.reg gmail.com



---
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


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.


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

(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: -------
Nov 02 2011
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=6880


Vladimir Panteleev <thecybershadow gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow gmail.com



14:40:04 PDT ---
It would help if you provided a stack trace. You can write a WinMain which
displays uncaught exceptions in a message box:
http://www.digitalmars.com/d/2.0/windows.html

You may find this helpful:

if (!GetConsoleWindow()) {
    stdout.open("stdout.log", "w");
    stderr.open("stderr.log", "w");
}

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