test: workaround for V8 8.1 inspector pause issue · nodejs/node@92a207c · GitHub
Skip to content

Commit 92a207c

Browse files
mmarchinitargos
authored andcommitted
test: workaround for V8 8.1 inspector pause issue
`test-inspector-multisession-ws` and `test-inspector-break-when-eval` will be affected by an upstream bug when we upgrade V8 to 8.1. The bug is caused when the Inspector sets a pause at the start of a function compiled with `CompileFunctionInContext`, but that function hasn't been executed yet. On both tests, this issue is triggered by pausing while in C++ executing LookupAndCompile, which is called by requiring internal modules while running `console.log`. To eliminate this issue in both tests, we add an extra `console.log` to ensure we only pause we required all internal modules we need. On `test-inspector-break-when-eval`, we also need to start the child process with `--inspect-brk` instead of `--inspect` to ensure the test is predictable (this test would occasianlly fail on slower machines, when console.log doesn't run fast enough to finish after emitting `Runtime.consoleAPICalled` and before the parent process sending `Runtime.evaluate` message. Ref: https://bugs.chromium.org/p/v8/issues/detail?id=10287 PR-URL: #32234 Refs: https://bugs.chromium.org/p/v8/issues/detail?id=10287 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 9b6f678 commit 92a207c

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

test/fixtures/inspector-global-function.js

Lines changed: 4 additions & 0 deletions

test/parallel/test-inspector-multisession-ws.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ session.on('Debugger.paused', () => {
2020
session.connect();
2121
session.post('Debugger.enable');
2222
console.log('Ready');
23+
console.log('Ready');
2324
`;
2425

2526
async function setupSession(node) {
@@ -46,6 +47,10 @@ async function testSuspend(sessionA, sessionB) {
4647
await sessionA.waitForNotification('Debugger.paused', 'Initial pause');
4748
sessionA.send({ 'method': 'Debugger.resume' });
4849

50+
await sessionA.waitForNotification('Runtime.consoleAPICalled',
51+
'Console output');
52+
// NOTE(mmarchini): Remove second console.log when
53+
// https://bugs.chromium.org/p/v8/issues/detail?id=10287 is fixed.
4954
await sessionA.waitForNotification('Runtime.consoleAPICalled',
5055
'Console output');
5156
sessionA.send({ 'method': 'Debugger.pause' });

test/sequential/test-inspector-break-when-eval.js

Lines changed: 12 additions & 2 deletions

0 commit comments

Comments
 (0)