Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
January 25, 2015 [Issue 6880] Heisenbug: deferred crash when writing to stdout on Windows without console. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6880 AndyC <andy@squeakycode.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |andy@squeakycode.net --- Comment #2 from AndyC <andy@squeakycode.net> --- I test this, on windows, with DMD v2.066.1: dmd -L/SUBSYSTEM:WINDOWS test.d import std.stdio; void main() { writ -- |
January 25, 2015 [Issue 6880] Heisenbug: deferred crash when writing to stdout on Windows without console. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6880 AndyC <andy@squeakycode.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |WORKSFORME --- Comment #3 from AndyC <andy@squeakycode.net> --- I test this, on windows, with DMD v2.066.1: ---- file test.d: import std.stdio; void main() { writeln("hello world"); } comile: dmd -L/SUBSYSTEM:WINDOWS test.d ran it by dbl-clicking and from cmd.exe. No exception, no error. I checked std/typecons.d and found no write's without debug. Closing. Please re-open if its still a problem, and please provide more specific steps to reproduce. "take tons of user feedback" doesn't help me fix the problem. -- |
January 25, 2015 [Issue 6880] Heisenbug: deferred crash when writing to stdout on Windows without console. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6880 Denis Shelomovskij <verylonglogin.reg@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED Resolution|WORKSFORME |--- --- Comment #4 from Denis Shelomovskij <verylonglogin.reg@gmail.com> --- (In reply to AndyC from comment #3) > I test this, on windows, with DMD v2.066.1: > > ---- file test.d: > import std.stdio; > > void main() > { > writeln("hello world"); > } > > > comile: > dmd -L/SUBSYSTEM:WINDOWS test.d > > ran it by dbl-clicking and from cmd.exe. No exception, no error. > > I checked std/typecons.d and found no write's without debug. > > Closing. > > Please re-open if its still a problem, and please provide more specific steps to reproduce. "take tons of user feedback" doesn't help me fix the problem. As I had written in the issue description it's a deffered failure (i.e. some buffer overflows). One can use any testcase which prints enough data to overflow the buffer, e.g.: --- import std.stdio; void main() { foreach(const i; 0 .. 100_000) write("12345678"); // for me fails at i = 2048 } --- -- |
January 25, 2015 [Issue 6880] Heisenbug: deferred crash when writing to stdout on Windows without console. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6880 --- Comment #5 from AndyC <andy@squeakycode.net> --- Confirmed. Breaks for me to. Do you know if there is a way to detect if a console exists? -- |
January 25, 2015 [Issue 6880] Heisenbug: deferred crash when writing to stdout on Windows without console. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6880 --- Comment #6 from Denis Shelomovskij <verylonglogin.reg@gmail.com> --- (In reply to AndyC from comment #5) > Confirmed. Breaks for me to. > > Do you know if there is a way to detect if a console exists? This information alone doesn't give you much as e.g. a stream can be redirected. Also I have already written all information I know about the issue here. -- |
January 25, 2015 [Issue 6880] Heisenbug: deferred crash when writing to stdout on Windows without console. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6880 --- Comment #7 from Vladimir Panteleev <thecybershadow@gmail.com> --- You can detect if your program is running in a console with: GetConsoleWindow() != NULL However, this is probably not what you want - instead you want to check if standard output is writable (you can probably create a GUI program and redirect its output somewhere, and the program will work fine). I'm not sure how to do that off the top of my head, though. -- |
June 10, 2015 [Issue 6880] Heisenbug: deferred crash when writing to stdout on Windows without console. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6880 Andrei Alexandrescu <andrei@erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|D1 & D2 |D2 -- |
June 27, 2017 [Issue 6880] Heisenbug: deferred crash when writing to stdout on Windows without console. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6880 --- Comment #8 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> --- As I understand, what happens here is: 1. The program starts, and writes data to stdout / stderr 2. The data goes into the C FILE* buffer 3. When the buffer fills up, the C runtime attempts to flush it 4. Upon flushing, it discovers that the output handle in non-writable Perhaps the runtime could detect an unwritable stdout/stderr and close (or otherwise make invalid) the respective std.stdio handles. Though, even if writeln was changed to check if the output handle is writable on first or every write, the steps to reproduce would still apply - a forgotten writeln inside some rarely-executed code, such as an error handler, can still go through initial testing and end up crashing the application on the end-user's site. -- |
December 17, 2022 [Issue 6880] Heisenbug: deferred crash when writing to stdout on Windows without console. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6880 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P2 |P3 -- |
June 20, 2023 [Issue 6880] Heisenbug: deferred crash when writing to stdout on Windows without console. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=6880 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://issues.dlang.org/sh | |ow_bug.cgi?id=24001 -- |
Copyright © 1999-2021 by the D Language Foundation