Skip to content

Commit 8b93fdd

Browse files
bnoordhuisMylesBorins
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 3a43b0d commit 8b93fdd

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
@@ -42,7 +42,10 @@ int wmain(int argc, wchar_t *wargv[]) {
4242
#else
4343
// UNIX
4444
int main(int argc, char *argv[]) {
45-
setvbuf(stderr, NULL, _IOLBF, 1024);
45+
// Disable stdio buffering, it interacts poorly with printf()
46+
// calls elsewhere in the program (e.g., any logging from V8.)
47+
setvbuf(stdout, nullptr, _IONBF, 0);
48+
setvbuf(stderr, nullptr, _IONBF, 0);
4649
return node::Start(argc, argv);
4750
}
4851
#endif

test/parallel/parallel.status

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ test-tick-processor : PASS,FLAKY
1515
[$system==macos]
1616

1717
[$system==solaris] # Also applies to SmartOS
18+
test-debug-signal-cluster : PASS,FLAKY
1819

1920
[$system==freebsd]
2021

0 commit comments

Comments
 (0)