Skip to content

src: do not call into JS in the maxAsyncCallStackDepthChanged interrupt

Rodrigo Muino Tomonari requested to merge github/fork/joyeecheung/interrupt into master

If Debugger.setAsyncCallStackDepth is sent during bootstrap, we cannot immediately call into JS to enable the hooks, which could interrupt the JS execution of bootstrap. So instead we save the notification in the inspector agent if it's sent in the middle of bootstrap, and process the notification later during pre-execution.

Example error caused by the interrupt calling into JS directly:

00:28:08     [err] async_hooks.js:32
00:28:08     [err]   async_id_symbol, trigger_async_id_symbol,
00:28:08     [err]   ^
00:28:08     [err] 
00:28:08     [err] TypeError: Cannot destructure property `async_id_symbol` of 'undefined' or 'null'.
00:28:08     [err]     at async_hooks.js:31:7
00:28:08     [err]     at NativeModule.compile (internal/bootstrap/loaders.js:300:5)
00:28:08     [err]     at nativeModuleRequire (internal/bootstrap/loaders.js:188:14)
00:28:08     [err]     at lazyHookCreation (internal/inspector_async_hook.js:8:26)
00:28:08     [err]     at enable (internal/inspector_async_hook.js:47:27)
00:28:08     [err]     at internal/async_hooks.js:1:1
00:28:08     [err]     at NativeModule.compile (internal/bootstrap/loaders.js:300:5)
00:28:08     [err]     at nativeModuleRequire (internal/bootstrap/loaders.js:188:14)
00:28:08     [err]     at internal/process/task_queues.js:31:5
00:28:08     [err]     at NativeModule.compile (internal/bootstrap/loaders.js:300:5)
00:28:08     [err]     at nativeModuleRequire (internal/bootstrap/loaders.js:188:14)

Refs: https://github.com/nodejs/node/issues/26798

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • commit message follows commit guidelines

Merge request reports

Loading