Skip to content

Commit

Permalink
src: disable stdio buffering
Browse files Browse the repository at this point in the history
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 <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
bnoordhuis authored and MylesBorins committed Oct 26, 2016
1 parent 3a43b0d commit 8b93fdd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/node_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ int wmain(int argc, wchar_t *wargv[]) {
#else
// UNIX
int main(int argc, char *argv[]) {
setvbuf(stderr, NULL, _IOLBF, 1024);
// Disable stdio buffering, it interacts poorly with printf()
// calls elsewhere in the program (e.g., any logging from V8.)
setvbuf(stdout, nullptr, _IONBF, 0);
setvbuf(stderr, nullptr, _IONBF, 0);
return node::Start(argc, argv);
}
#endif
1 change: 1 addition & 0 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ test-tick-processor : PASS,FLAKY
[$system==macos]

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

[$system==freebsd]

Expand Down

0 comments on commit 8b93fdd

Please sign in to comment.