From 844200f24ed4118aed109d40bcf2dda81735dbaf Mon Sep 17 00:00:00 2001 From: Andreas Madsen Date: Thu, 19 Oct 2017 12:43:40 +0200 Subject: [PATCH] async_hooks: skip runtime checks when disabled PR-URL: https://github.com/nodejs/node/pull/15454 Ref: https://github.com/nodejs/node/pull/14387 Ref: https://github.com/nodejs/node/pull/14722 Ref: https://github.com/nodejs/node/issues/14717 Ref: https://github.com/nodejs/node/issues/15448 Reviewed-By: Refael Ackermann Reviewed-By: Matteo Collina Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- doc/api/cli.md | 8 +++ doc/ayo.1 | 5 ++ lib/_http_outgoing.js | 10 ++- lib/async_hooks.js | 62 +++++++++---------- lib/internal/process/next_tick.js | 2 +- src/async-wrap.cc | 1 + src/env-inl.h | 23 +++++-- src/env.h | 3 + src/node.cc | 22 +++++-- test/async-hooks/test-emit-init.js | 57 ++++++++++------- test/async-hooks/test-force-checks-flag.js | 25 ++++++++ .../test-internal-nexttick-default-trigger.js | 5 -- .../test-no-assert-when-disabled.js | 26 ++++++++ test/common/index.js | 11 ++++ ...pector-async-hook-teardown-at-debug-end.js | 19 ++---- 15 files changed, 192 insertions(+), 87 deletions(-) create mode 100644 test/async-hooks/test-force-checks-flag.js create mode 100644 test/async-hooks/test-no-assert-when-disabled.js diff --git a/doc/api/cli.md b/doc/api/cli.md index 4b2f78d94a..b6d778f5ac 100644 --- a/doc/api/cli.md +++ b/doc/api/cli.md @@ -208,6 +208,14 @@ 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` + + +Enables runtime checks for `async_hooks`. These can also be enabled dynamically +by enabling one of the `async_hooks` hooks. + ### `--trace-events-enabled`