You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current working thesis: contextCreated notification doesn't always arrive to CDP (checked packets with WireShark). It seems there's a race condition when this notification is sent. Needs more investigation.
Investigated more, this specific problem happens with this code:
let i = 0;
while (true) {
doSomething(10000);
i++;
}
function doSomething(breakDuration) {
console.log("hello %i", i);
console.timeStamp();
const started = performance.now();
let canBreak = false;
while (!canBreak) {
canBreak = performance.now() - started >= breakDuration;
}
}
It's a synchronous code that runs busy loop. The problem stems from the fact that control is never yielded back to the event loop and thus it has no chance to pump messages from the inspector which in turn causes it to never properly attach.
bartlomieju
changed the title
Sometimes can't debug with --inspect flag, only --inspect-brk
Busy-loop code makes it impossible to attach inspector
Nov 26, 2022
Following situation works with --inspect-brk but not with --inspect.
Screen recording:
Screen.Recording.2022-11-20.at.20.08.02.mov
Notice that I can't open any file, start a memory profile or CPU profile.
The text was updated successfully, but these errors were encountered: