Skip to content

Commit

Permalink
debugger: fix race condition/deadlock on initialization
Browse files Browse the repository at this point in the history
PR-URL: #38161
Refs: #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 authored and targos committed Apr 29, 2021
1 parent 93b0c78 commit 37b5ce2
Showing 1 changed file with 10 additions and 13 deletions.
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

0 comments on commit 37b5ce2

Please sign in to comment.