Skip to content

Commit fbc9ef8

Browse files
bnoordhuisevanlucas
authored andcommitted
src: disable stdio buffering
Disable stdio buffering, it interacts poorly with printf() calls from elsewhere in the program (e.g., any logging from V8.) Unbreaks among other things the `--trace_debug_json` switch. Undoes commit 0966ab9 ("src: force line buffering for stderr"), which in retrospect is not a proper fix. Turning on line buffering fixed a flaky test on SmartOS but the test wasn't failing on other platforms, where stderr wasn't line-buffered either. Mark the test flaky again, it failed once in a run of 333 tries on the smartos-64 buildbot. Disabling buffering should be safe even when mixed with non-blocking stdio I/O because libuv goes to great lengths to reopen the tty file descriptors and falls back to blocking I/O when that fails. PR-URL: #7610 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent df697c4 commit fbc9ef8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/node_main.cc

+4-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ int wmain(int argc, wchar_t *wargv[]) {
5050
#else
5151
// UNIX
5252
int main(int argc, char *argv[]) {
53-
setvbuf(stderr, NULL, _IOLBF, 1024);
53+
// Disable stdio buffering, it interacts poorly with printf()
54+
// calls elsewhere in the program (e.g., any logging from V8.)
55+
setvbuf(stdout, nullptr, _IONBF, 0);
56+
setvbuf(stderr, nullptr, _IONBF, 0);
5457
return node::Start(argc, argv);
5558
}
5659
#endif

test/parallel/parallel.status

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ test-tls-connect-address-family : PASS,FLAKY
2222
[$system==macos]
2323

2424
[$system==solaris] # Also applies to SmartOS
25+
test-debug-signal-cluster : PASS,FLAKY
2526

2627
[$system==freebsd]
2728

0 commit comments

Comments
 (0)