mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 15:30:56 +01:00
a0895ed6c4
Implement a special async_hooks listener that forwards information about async tasks to V8Inspector asyncTask* API, thus enabling DevTools feature "async stack traces". The feature is enabled only on 64bit platforms due to a technical limitation of V8 Inspector: inspector uses a pointer as a task id, while async_hooks use 64bit numbers as ids. To avoid performance penalty of async_hooks when not debugging, the new listener is enabled only when the process enters a debug mode: - When the process is started with `--inspect` or `--inspect-brk`, the listener is enabled immediately and async stack traces lead all the way to the first tick of the event loop. - When the debug mode is enabled via SIGUSR1 or `_debugProcess()`, the listener is enabled together with the debugger. As a result, only async operations started after the signal was received will be correctly observed and reported to V8 Inspector. For example, a `setInterval()` called in the first tick of the event will not be shown in the async stack trace when the callback is invoked. This behaviour is consistent with Chrome DevTools. Last but not least, this commit fixes handling of InspectorAgent's internal property `enabled_` to ensure it's set back to `false` after the debugger is deactivated (typically via `process._debugEnd()`). Fixes: https://github.com/nodejs/node/issues/11370 PR-URL: https://github.com/nodejs/node/pull/13870 Reviewed-by: Timothy Gu <timothygu99@gmail.com> Reviewed-by: Anna Henningsen <anna@addaleax.net> |
||
---|---|---|
.. | ||
cluster | ||
http2 | ||
process | ||
streams | ||
test | ||
bootstrap_node.js | ||
buffer.js | ||
child_process.js | ||
encoding.js | ||
errors.js | ||
freelist.js | ||
fs.js | ||
http.js | ||
inspector_async_hook.js | ||
linkedlist.js | ||
module.js | ||
net.js | ||
os.js | ||
process.js | ||
querystring.js | ||
readline.js | ||
readme.md | ||
repl.js | ||
socket_list.js | ||
url.js | ||
util.js | ||
v8_prof_polyfill.js | ||
v8_prof_processor.js |
Internal Modules
The modules in lib/internal
are intended for internal use in Node.js core
only, and are not accessible with require()
from user modules. These are
subject to change at any time. Reliance on these modules outside of core
is not supported in any way.