Skip to content
Prev Previous commit
Next Next commit
debugger: fix race condition/deadlock on initialization
PR-URL: #38161
Refs: https://github.com/nodejs/node/discussions/36481
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
Trott committed Apr 25, 2021
commit 60a07645018406fa4c6c007a022f65574e5df744
23 changes: 10 additions & 13 deletions lib/internal/inspector/inspect_repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -1062,19 +1062,16 @@ function createRepl(inspector) {
}

function initAfterStart() {
const setupTasks = [
Runtime.enable(),
Profiler.enable(),
Profiler.setSamplingInterval({ interval: 100 }),
Debugger.enable(),
Debugger.setPauseOnExceptions({ state: 'none' }),
Debugger.setAsyncCallStackDepth({ maxDepth: 0 }),
Debugger.setBlackboxPatterns({ patterns: [] }),
Debugger.setPauseOnExceptions({ state: pauseOnExceptionState }),
restoreBreakpoints(),
Runtime.runIfWaitingForDebugger(),
];
return Promise.all(setupTasks);
return Runtime.enable()
.then(() => Profiler.enable())
.then(() => Profiler.setSamplingInterval({ interval: 100 }))
.then(() => Debugger.enable())
.then(() => Debugger.setPauseOnExceptions({ state: 'none' }))
.then(() => Debugger.setAsyncCallStackDepth({ maxDepth: 0 }))
.then(() => Debugger.setBlackboxPatterns({ patterns: [] }))
.then(() => Debugger.setPauseOnExceptions({ state: pauseOnExceptionState }))
.then(() => restoreBreakpoints())
.then(() => Runtime.runIfWaitingForDebugger())
}

return function startRepl() {
Expand Down