core: implement runtime flag to trace sync io
authorTrevor Norris <trev.norris@gmail.com>
Thu, 14 May 2015 17:46:54 +0000 (11:46 -0600)
committerTrevor Norris <trev.norris@gmail.com>
Mon, 18 May 2015 16:05:32 +0000 (10:05 -0600)
commitc1de6d249e9b17d53edc0a713c1e43ef9b457ea7
treefba50f35b3a2266d52eb70cce48fcd7ac0eaf7cf
parent066274794c077c9323109f95ff0efe53e17d323a
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>
node.gyp
src/env-inl.h
src/env.cc [new file with mode: 0644]
src/env.h
src/node.cc
src/node_crypto.cc
src/node_file.cc
src/node_zlib.cc
src/spawn_sync.cc
test/parallel/test-sync-io-option.js [new file with mode: 0644]