Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
8922bba
deps: update npm to 5.5.1
MylesBorins Oct 27, 2017
0ea8ff3
deps: backport 4ca695819 from npm upstream
MylesBorins Oct 27, 2017
237067d
deps: manually add 9.x support to npm
MylesBorins Oct 26, 2017
4fdd76d
http2: fix stream reading resumption
apapirovski Oct 29, 2017
ef238fb
v8: migrate setFlagsFromString to internal/errors
jasnell Oct 26, 2017
07d71c9
async_hooks: enable runtime checks by default
AndreasMadsen Oct 19, 2017
decb9e7
doc: add license information for remark-cli
MylesBorins Oct 31, 2017
ed92e0c
doc: add Gibson Fahnestock to Release team
gibfahn Oct 30, 2017
45873d2
module: revert #3384 DEP0019 EOL
MylesBorins Oct 31, 2017
daa286a
2017-10-31, Version 8.9.0 'Carbon' (LTS) Release
gibfahn Oct 31, 2017
fa9990f
2017-10-31, Version 9.0.0 (Current)
jasnell Sep 1, 2017
a933179
implement intialize(), tear_down(), process_events() for shared lib API
justus-hildebrand Dec 13, 2017
1906ddd
forgot to remove the node_lib include
justus-hildebrand Dec 18, 2017
f685a03
update ReadMe
justus-hildebrand Dec 18, 2017
8b01e1e
Update README.md
justus-hildebrand Dec 18, 2017
819c0f6
added nodelib interface v0.3
Dec 18, 2017
0280f31
Build on Travis (#6)
cmfcmf Dec 18, 2017
42a0104
revert changes made to node.cc and node.h
justus-hildebrand Jan 4, 2018
f4a5f64
Merge branch 'node_lib' of github.com:hpicgs/node into node_lib
justus-hildebrand Jan 4, 2018
d88e1d5
WIP: added more calling convenience
Jan 4, 2018
c9949a5
Renamed nodelib to node_lib
Jan 4, 2018
02493bb
Added Linux build commands to README
luminosuslight Jan 4, 2018
aa2c043
implement Terminate(), RequestTerminate(), RunEventLoop()
justus-hildebrand Jan 5, 2018
6ed7163
Short comments on what the Start() funcs do
justus-hildebrand Jan 5, 2018
2fae0db
Implemented Initialize(), Run() and Evaluate()
cmfcmf Jan 7, 2018
c01f4e5
Replace argc agrv in Initialize() with std::string
luminosuslight Jan 8, 2018
6acebd9
wip
msoechting Jan 8, 2018
4ad8cce
Cleaned code style (no indent for namespaces, left-lean asteriks, uni…
luminosuslight Jan 9, 2018
cc91ae3
Refactored cmd arg generation
luminosuslight Jan 9, 2018
4812646
Fixed cmd args
luminosuslight Jan 9, 2018
9a264ce
Moved code from Initialize() to new functions
luminosuslight Jan 9, 2018
ef6b4e5
Removed unused v8 argc argv
luminosuslight Jan 10, 2018
53f74b8
Implement remaining Call() methods
cmfcmf Jan 10, 2018
d5bb393
Re-add missing node.h include
cmfcmf Jan 14, 2018
d7d4b2b
Make RegisterModule work. Sadly, we can't use std::function|s, becaus…
cmfcmf Jan 14, 2018
f3e7a6d
fix issues from comments on PR #16
justus-hildebrand Jan 15, 2018
7a59273
Fix pointer to stack variable in register module
luminosuslight Jan 15, 2018
9175443
Use UV_RUN_NOWAIT, @justus-hildebrand
cmfcmf Jan 16, 2018
75f39b0
Merge branch 'interface-implementation' of github.com:hpicgs/node int…
cmfcmf Jan 16, 2018
674c0ee
add comments and TODOs for investigation
justus-hildebrand Jan 17, 2018
4e32b91
Implement `Deinitialize()` and `StopEventLoop()`
Jan 19, 2018
734d0d6
Don't read from stdin
cmfcmf Jan 19, 2018
0c575d5
Merge pull request #16 from hpicgs/interface-implementation
Jan 22, 2018
b945ac7
WIP usage
msoechting Jan 22, 2018
78329e0
Update usage documentation
msoechting Jan 22, 2018
6ea63e2
added code docu
Jan 22, 2018
a323279
refactored internals
Jan 24, 2018
6126411
Option to auto-call process.binding() when calling RegisterModule() (…
justus-hildebrand Jan 24, 2018
0ee4348
Rename getters to match style guide
cmfcmf Jan 29, 2018
200c1a9
added error handling via MaybeLocal (#40)
Jan 29, 2018
ee01950
Add support for cmd args (#39)
luminosuslight Jan 29, 2018
d7c8a33
Merge branch 'node_lib' into expose_internals
cmfcmf Jan 29, 2018
22a3107
Update README.md
EmberFlare Jan 29, 2018
5e7adc7
Merge branch 'node_lib' into expose_internals
EmberFlare Jan 29, 2018
e582066
early check for uv_loop_alive(), small refactoring
justus-hildebrand Jan 29, 2018
25211e6
Merge pull request #41 from hpicgs/expose_internals
Jan 30, 2018
6854d8f
changed the way internals are exposed.
Jan 30, 2018
807709d
included feedback from PR
Jan 30, 2018
c51f3f6
Fix method names
luminosuslight Jan 30, 2018
c5c73ff
fix nits
justus-hildebrand Jan 30, 2018
2bb42fb
Merge branch 'node_lib' into tick-event-loop-early-exit
justus-hildebrand Jan 30, 2018
ecee92a
Merge pull request #46 from hpicgs/tick-event-loop-early-exit
luminosuslight Jan 30, 2018
588ab28
moved 'EventLoopIsRunning' back to node::lib
Jan 30, 2018
b607c9f
Merge branch 'node_lib' into expose_internals
justus-hildebrand Jan 30, 2018
5539564
Merge pull request #47 from hpicgs/expose_internals
Jan 31, 2018
40baf2c
Merge branch 'node_lib' into lib-usage-documentation
EmberFlare Jan 31, 2018
e693ecf
added code docu
Jan 22, 2018
0ed0c77
included feedback from PR
Jan 30, 2018
2e6b1ff
fixed merge problems, added more docu for new methods
Jan 31, 2018
c913d75
Merge remote-tracking branch 'origin/interface_docu' into interface_docu
Jan 31, 2018
9c6bf17
Merge pull request #37 from hpicgs/interface_docu
EmberFlare Jan 31, 2018
cac4d43
Merge branch 'node_lib' into lib-usage-documentation
EmberFlare Jan 31, 2018
fd520a7
Merge pull request #35 from hpicgs/lib-usage-documentation
EmberFlare Jan 31, 2018
fe6a38a
Start fixing code style
luminosuslight Feb 1, 2018
334c3a6
Fix more code style, left leaning asterisks
luminosuslight Feb 1, 2018
f45be81
Fix C style cast
luminosuslight Feb 1, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
async_hooks: enable runtime checks by default
Ref: #15454
PR-URL: #16318
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
  • Loading branch information
AndreasMadsen authored and jasnell committed Oct 30, 2017
commit 07d71c94ef7e3946a2d0589557299c3c978dfb99
6 changes: 3 additions & 3 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,13 @@ added: v2.1.0
Prints a stack trace whenever synchronous I/O is detected after the first turn
of the event loop.

### `--force-async-hooks-checks`
### `--no-force-async-hooks-checks`
<!-- YAML
added: REPLACEME
-->

Enables runtime checks for `async_hooks`. These can also be enabled dynamically
by enabling one of the `async_hooks` hooks.
Disables runtime checks for `async_hooks`. These will still be enabled
dynamically when `async_hooks` is enabled.

### `--trace-events-enabled`
<!-- YAML
Expand Down
6 changes: 3 additions & 3 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ Print a stack trace whenever synchronous I/O is detected after the first turn
of the event loop.

.TP
.BR \-\-force\-async\-hooks\-checks
Enables runtime checks for `async_hooks`. These can also be enabled dynamically
by enabling one of the `async_hooks` hooks.
.BR \-\-no\-force\-async\-hooks\-checks
Disables runtime checks for `async_hooks`. These will still be enabled
dynamically when `async_hooks` is enabled.

.TP
.BR \-\-trace\-events\-enabled
Expand Down
13 changes: 10 additions & 3 deletions src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ inline Environment::AsyncHooks::AsyncHooks(v8::Isolate* isolate)
async_id_fields_(isolate, kUidFieldsCount) {
v8::HandleScope handle_scope(isolate_);

// Always perform async_hooks checks, not just when async_hooks is enabled.
// TODO(AndreasMadsen): Consider removing this for LTS releases.
// See discussion in https://github.com/nodejs/node/pull/15454
// When removing this, do it by reverting the commit. Otherwise the test
// and flag changes won't be included.
fields_[kCheck] = 1;

// kAsyncIdCounter should start at 1 because that'll be the id the execution
// context during bootstrap (code that runs before entering uv_run()).
async_id_fields_[AsyncHooks::kAsyncIdCounter] = 1;
Expand Down Expand Up @@ -129,9 +136,9 @@ inline v8::Local<v8::String> Environment::AsyncHooks::provider_string(int idx) {
return providers_[idx].Get(isolate_);
}

inline void Environment::AsyncHooks::force_checks() {
// fields_ does not have the += operator defined
fields_[kCheck] = fields_[kCheck] + 1;
inline void Environment::AsyncHooks::no_force_checks() {
// fields_ does not have the -= operator defined
fields_[kCheck] = fields_[kCheck] - 1;
}

inline void Environment::AsyncHooks::push_async_ids(double async_id,
Expand Down
2 changes: 1 addition & 1 deletion src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ class Environment {

inline v8::Local<v8::String> provider_string(int idx);

inline void force_checks();
inline void no_force_checks();

inline void push_async_ids(double async_id, double trigger_async_id);
inline bool pop_async_id(double async_id);
Expand Down
16 changes: 8 additions & 8 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static bool syntax_check_only = false;
static bool trace_deprecation = false;
static bool throw_deprecation = false;
static bool trace_sync_io = false;
static bool force_async_hooks_checks = false;
static bool no_force_async_hooks_checks = false;
static bool track_heap_objects = false;
static const char* eval_string = nullptr;
static std::vector<std::string> preload_modules;
Expand Down Expand Up @@ -3899,8 +3899,8 @@ static void PrintHelp() {
" stderr\n"
" --trace-sync-io show stack trace when use of sync IO\n"
" is detected after the first tick\n"
" --force-async-hooks-checks\n"
" enables checks for async_hooks\n"
" --no-force-async-hooks-checks\n"
" disable checks for async_hooks\n"
" --trace-events-enabled track trace events\n"
" --trace-event-categories comma separated list of trace event\n"
" categories to record\n"
Expand Down Expand Up @@ -4026,7 +4026,7 @@ static void CheckIfAllowedInEnv(const char* exe, bool is_env,
"--trace-warnings",
"--redirect-warnings",
"--trace-sync-io",
"--force-async-hooks-checks",
"--no-force-async-hooks-checks",
"--trace-events-enabled",
"--trace-events-categories",
"--track-heap-objects",
Expand Down Expand Up @@ -4165,8 +4165,8 @@ static void ParseArgs(int* argc,
trace_deprecation = true;
} else if (strcmp(arg, "--trace-sync-io") == 0) {
trace_sync_io = true;
} else if (strcmp(arg, "--force-async-hooks-checks") == 0) {
force_async_hooks_checks = true;
} else if (strcmp(arg, "--no-force-async-hooks-checks") == 0) {
no_force_async_hooks_checks = true;
} else if (strcmp(arg, "--trace-events-enabled") == 0) {
trace_enabled = true;
} else if (strcmp(arg, "--trace-event-categories") == 0) {
Expand Down Expand Up @@ -4815,8 +4815,8 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,

env.set_abort_on_uncaught_exception(abort_on_uncaught_exception);

if (force_async_hooks_checks) {
env.async_hooks()->force_checks();
if (no_force_async_hooks_checks) {
env.async_hooks()->no_force_checks();
}

{
Expand Down
25 changes: 0 additions & 25 deletions test/async-hooks/test-force-checks-flag.js

This file was deleted.

10 changes: 1 addition & 9 deletions test/async-hooks/test-no-assert-when-disabled.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
'use strict';
// Flags: --expose-internals
// Flags: --no-force-async-hooks-checks --expose-internals
const common = require('../common');

const async_hooks = require('async_hooks');
const internal = require('internal/process/next_tick');

// In tests async_hooks dynamic checks are enabled by default. To verify
// that no checks are enabled ordinarily disable the checks in this test.
common.revert_force_async_hooks_checks();

// When async_hooks is diabled (or never enabled), the checks
// should be disabled as well. This is important while async_hooks is
// experimental and there are still critial bugs to fix.

// Using undefined as the triggerAsyncId.
// Ref: https://github.com/nodejs/node/issues/14386
// Ref: https://github.com/nodejs/node/issues/14381
Expand Down
11 changes: 0 additions & 11 deletions test/common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,6 @@ exports.projectDir = path.resolve(__dirname, '..', '..');

exports.buildType = process.config.target_defaults.default_configuration;

// Always enable async_hooks checks in tests
{
const async_wrap = process.binding('async_wrap');
const { kCheck } = async_wrap.constants;
async_wrap.async_hook_fields[kCheck] += 1;

exports.revert_force_async_hooks_checks = function() {
async_wrap.async_hook_fields[kCheck] -= 1;
};
}

// If env var is set then enable async_hook hooks for all tests.
if (process.env.NODE_TEST_WITH_ASYNC_HOOKS) {
const destroydIdsList = {};
Expand Down