diff options
author | Trevor Norris <trev.norris@gmail.com> | 2015-05-14 20:46:54 +0300 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2015-05-18 19:05:32 +0300 |
commit | c1de6d249e9b17d53edc0a713c1e43ef9b457ea7 (patch) | |
tree | fba50f35b3a2266d52eb70cce48fcd7ac0eaf7cf /src/env.h | |
parent | 066274794c077c9323109f95ff0efe53e17d323a (diff) |
core: implement runtime flag to trace sync io
Use the --trace-sync-io flag to print a stack trace whenever a sync
method is used after the first tick, excluding during the process exit
event. (e.g. fs.readFileSync()) It does not track if the warning has
occurred at a specific location in the past and so will print the
warning every time.
Reason for not printing during the first tick of the appication is so
all necessary resources can be required. Also by excluding synchronous
calls during exit is necessary in case any data needs to be logged out
by the application before it shuts down.
Fixes: https://github.com/nodejs/io.js/issues/1674
PR-URL: https://github.com/nodejs/io.js/pull/1707
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Fedor Indutny <fedor@indutny.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Petka Antonov <petka_antonov@hotmail.com>
Diffstat (limited to 'src/env.h')
-rw-r--r-- | src/env.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/env.h b/src/env.h index e327786e36b..b53ff87fb13 100644 --- a/src/env.h +++ b/src/env.h @@ -420,6 +420,9 @@ class Environment { inline bool printed_error() const; inline void set_printed_error(bool value); + void PrintSyncTrace() const; + inline void set_trace_sync_io(bool value); + inline void ThrowError(const char* errmsg); inline void ThrowTypeError(const char* errmsg); inline void ThrowRangeError(const char* errmsg); @@ -506,6 +509,7 @@ class Environment { bool using_abort_on_uncaught_exc_; bool using_asyncwrap_; bool printed_error_; + bool trace_sync_io_; debugger::Agent debugger_agent_; HandleWrapQueue handle_wrap_queue_; |