Skip to content

Commit

Permalink
Revert "src: remove trace_sync_io_ from env"
Browse files Browse the repository at this point in the history
This reverts commit 7fa5f54.

The reverted commit breaks the logic behind --trace-sync-io, it should
be enabled only at a certain point in time, while that commit enables
it from the very start, causing warnings be printed for all sync io
instead of sync io after the first tick of the event loop as documented.

Fixes: nodejs#28913
Refs: nodejs#22726
Refs: https://nodejs.org/api/cli.html#cli_trace_sync_io
PR-URL: nodejs#28926
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
ChALkeR authored and Trott committed Aug 4, 2019
1 parent 5eaef7b commit aa252eb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ inline void Environment::set_printed_error(bool value) {
}

inline void Environment::set_trace_sync_io(bool value) {
options_->trace_sync_io = value;
trace_sync_io_ = value;
}

inline bool Environment::abort_on_uncaught_exception() const {
Expand Down
2 changes: 1 addition & 1 deletion src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ void Environment::StopProfilerIdleNotifier() {
}

void Environment::PrintSyncTrace() const {
if (!options_->trace_sync_io) return;
if (!trace_sync_io_) return;

HandleScope handle_scope(isolate());

Expand Down
1 change: 1 addition & 0 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -1272,6 +1272,7 @@ class Environment : public MemoryRetainer {
const uint64_t timer_base_;
std::shared_ptr<KVStore> env_vars_;
bool printed_error_ = false;
bool trace_sync_io_ = false;
bool emit_env_nonstring_warning_ = true;
bool emit_err_name_warning_ = true;
size_t async_callback_scope_depth_ = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/node_main_instance.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ int NodeMainInstance::Run() {
env->async_hooks()->pop_async_id(1);
}

env->set_trace_sync_io(env->options()->trace_sync_io);

{
SealHandleScope seal(isolate_);
bool more;
Expand Down

0 comments on commit aa252eb

Please sign in to comment.