Regression in inspectors when entering certain frames

  • Version: v14.0.0-pre
  • Platform: Linux toolbox 5.4.10-200.fc31.x86_64 #1 SMP Thu Jan 9 19:58:12 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: ?

Recently on master there seems to be a regression in inspecting. For example, I can't seem to enter the constructor of EventEmitter while debugging. With node-inspect, the process exits when you try to enter an affected frame (which may be a separate bug in node-inspect), and with Chromium devtools simply nothing happens when trying to enter an affected frame. I bisected this down to commit a9fb51f.

What steps will reproduce the bug?

It's most obvious when using node-inspect. Here's a snippet that reproduces it reliably for me:

debuggerbug.js:

const EventEmitter = require('events');
new EventEmitter();

Run this in node-inspect, step to next line, then step in, and node-inspect will exit.

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

Once you hit a frame that exhibits the behaviour, it reproduces 100% of the time.

What is the expected behavior?

Debugging the snippet listed above with node 12.16.1:

$ node inspect debuggerbug.js 
< Debugger listening on ws://127.0.0.1:9229/b341c6b2-3a49-4ccb-8532-dbdde04c43a8
< For help, see: https://nodejs.org/en/docs/inspector
< Debugger attached.
Break on start in debuggerbug.js:1
> 1 const EventEmitter = require('events');
  2 new EventEmitter();
  3 
debug> n
break in debuggerbug.js:2
  1 const EventEmitter = require('events');
> 2 new EventEmitter();
  3 
debug> s
break in events.js:65
 63 
 64 function EventEmitter(opts) {
>65   EventEmitter.init.call(this, opts);
 66 }
 67 module.exports = EventEmitter;
debug>

What do you see instead?

Debugging the snippet listed above with node built from master:

$ ./node inspect debuggerbug.js
< Debugger listening on ws://127.0.0.1:9229/3c103069-28fb-4a95-ba99-a7e6ff344c72
< For help, see: https://nodejs.org/en/docs/inspector
< Debugger attached.
Break on start in debuggerbug.js:1
> 1 const EventEmitter = require('events');
  2 new EventEmitter();
  3 
debug> n
break in debuggerbug.js:2
  1 const EventEmitter = require('events');
> 2 new EventEmitter();
  3 
debug> s
debug> There was an internal error in node-inspect. Please report this bug.
No script for id: 13 - undefined
Error: No script for id: 13 - undefined
    at _pending.<computed> (internal/deps/node-inspect/lib/internal/inspect_client.js:243:27)
    at Client._handleChunk (internal/deps/node-inspect/lib/internal/inspect_client.js:213:11)
    at Socket.emit (events.js:315:20)
    at Socket.EventEmitter.emit (domain.js:485:12)
    at addChunk (_stream_readable.js:299:12)
    at readableAddChunk (_stream_readable.js:275:9)
    at Socket.Readable.push (_stream_readable.js:216:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:191:23)

Additional information

It's quite possible that this uncovers a separate bug in node-inspect, but I reported it here first because it seems to affect all inspectors. Using ./node --inspect-brk debuggerbug.js with Chromium devtools, you also cannot enter the EventEmitter frame. The UI does nothing when you click the Step In button.