node icon indicating copy to clipboard operation
node copied to clipboard

Debuggers cannot set breakpoints in certain Node.js internals

Open connor4312 opened this issue 1 year ago • 0 comments

Version

21.4.0

Platform

Darwin mbp.peet.io 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:27:27 PDT 2023; root:xnu-10002.41.9~6/RELEASE_X86_64 x86_64

Subsystem

inspector

What steps will reproduce the bug?

  1. Have a script containing setTimeout(() => {}, 0); setTimeout(() => {}, 0)
  2. Debug the script in your choice of debugger.
  3. Step into setTimeout and set a breakpoint in `timers. Continue.

How often does it reproduce? Is there a required condition?

100%

What is the expected behavior? Why is that the expected behavior?

The breakpoint should bind and the debugger should pause in the next call to setTimeout()

What do you see instead?

The debugger doesn't pause and the process exits

Additional information

  • Chrome devtools will set the breakpoint via Debugger.setBreakpointByUrl , but setting the breakpoint by the script ID (Debugger.setBreakpoint) of timers also does not work, returning error -32000 "Could not resolve breakpoint"
  • This regressed between Node 14 and Node 16
  • This appears to only affect scripts loaded into executionContextId: 0. Breakpoints in other scripts, such code in crypto, work without issue.
  • Potentially related to https://github.com/nodejs/node/issues/47438

connor4312 avatar Dec 05 '23 23:12 connor4312