-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
src: skip inspector wait in internal workers
Internal workers are essential to load user scripts and bootstrapped with internal entrypoints. They should not be waiting for inspectors even when `--inspect-brk` and `--inspect-wait` were specified, and avoid blocking main thread to bootstrap. IsolateData can be created with a specified PerIsolateOptions instead of creating a copy from the per_process namespace. This also avoids creating a copy bypassing the parent env's modified options, like creating a worker thread from a worker thread. PR-URL: #54219 Fixes: #53681 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
- Loading branch information
1 parent
b93c6d9
commit a394219
Showing
10 changed files
with
148 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// This tests esm loader's internal worker will not be blocked by --inspect-brk. | ||
// Regression: https://github.com/nodejs/node/issues/53681 | ||
|
||
'use strict'; | ||
const common = require('../common'); | ||
|
||
common.skipIfInspectorDisabled(); | ||
|
||
const assert = require('assert'); | ||
const fixtures = require('../common/fixtures'); | ||
const { NodeInstance } = require('../common/inspector-helper.js'); | ||
|
||
async function runIfWaitingForDebugger(session) { | ||
const commands = [ | ||
{ 'method': 'Runtime.enable' }, | ||
{ 'method': 'Debugger.enable' }, | ||
{ 'method': 'Runtime.runIfWaitingForDebugger' }, | ||
]; | ||
|
||
await session.send(commands); | ||
await session.waitForNotification('Debugger.paused'); | ||
} | ||
|
||
async function runTest() { | ||
const main = fixtures.path('es-module-loaders', 'register-loader.mjs'); | ||
const child = new NodeInstance(['--inspect-brk=0'], '', main); | ||
|
||
const session = await child.connectInspectorSession(); | ||
await runIfWaitingForDebugger(session); | ||
await session.runToCompletion(); | ||
assert.strictEqual((await child.expectShutdown()).exitCode, 0); | ||
} | ||
|
||
runTest(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// This tests esm loader's internal worker will not be blocked by --inspect-wait. | ||
// Regression: https://github.com/nodejs/node/issues/53681 | ||
|
||
'use strict'; | ||
const common = require('../common'); | ||
|
||
common.skipIfInspectorDisabled(); | ||
|
||
const assert = require('assert'); | ||
const fixtures = require('../common/fixtures'); | ||
const { NodeInstance } = require('../common/inspector-helper.js'); | ||
|
||
async function runIfWaitingForDebugger(session) { | ||
const commands = [ | ||
{ 'method': 'Runtime.enable' }, | ||
{ 'method': 'Debugger.enable' }, | ||
{ 'method': 'Runtime.runIfWaitingForDebugger' }, | ||
]; | ||
|
||
await session.send(commands); | ||
} | ||
|
||
async function runTest() { | ||
const main = fixtures.path('es-module-loaders', 'register-loader.mjs'); | ||
const child = new NodeInstance(['--inspect-wait=0'], '', main); | ||
|
||
const session = await child.connectInspectorSession(); | ||
await runIfWaitingForDebugger(session); | ||
await session.waitForDisconnect(); | ||
assert.strictEqual((await child.expectShutdown()).exitCode, 0); | ||
} | ||
|
||
runTest(); |