Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chrome devtools console method autocompletion for node is not working #56637

Open
bughit opened this issue Jan 17, 2025 · 6 comments
Open

Chrome devtools console method autocompletion for node is not working #56637

bughit opened this issue Jan 17, 2025 · 6 comments
Labels
inspector Issues and PRs related to the V8 inspector protocol

Comments

@bughit
Copy link

bughit commented Jan 17, 2025

Version

v22.13.0

Platform

Microsoft Windows NT 10.0.19045.0 x64

Subsystem

No response

What steps will reproduce the bug?

  1. open Chrome 132.0.6834.84 and load chrome://inspect
  2. open dedicated devtools for node
  3. run "node --inspect"
  4. wait for node to connect to devtools
  5. enter "global." in the devtools console
  6. the autocompletion method list does not pop up

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

always

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

The autocompletion method list is expected to pop up as it does for browser objects and as it used to for node:

Image

What do you see instead?

No autocomplete method popup.

Additional information

Since this is working in Chrome 113, it appeared as a Chrome issue and was submitted on the Chrome bug tracker, but was closed with the following response:

https://issues.chromium.org/u/2/issues/390205856#comment5

This is a Node.js issue. I can reproduce this down to Node 14, but with Node 12 autocompletion works as expected.

The way autocompletion of object properties works is that we evaluate the input, but abort if this evaluation may cause a side effect. Without side effect, we get the object properties and offer these properties as autocomplete options.

From Node 14, side effect check fails. You can easily check this by running Node with node --trace-side-effect-free-evaluate --inspect.

I would suggest you file an issue on the Node issue tracker.

@legendecas legendecas added the inspector Issues and PRs related to the V8 inspector protocol label Jan 17, 2025
@legendecas
Copy link
Member

Image

I can not reproduce with Chrome 132 and Node.js version 22.13.0. Please be aware that if the Node.js process is running a busy loop, the devtools will not be able to prompt any autocompletion as it can not interrupt a busy loop for autocompletion.

If it is possible, would you mind sharing a minimum reproduction script that you are inspecting? Thank you!

@legendecas legendecas added the needs more info Issues without a valid reproduction. label Jan 20, 2025
@bughit
Copy link
Author

bughit commented Jan 20, 2025

Your screenshot doesn't look like windows, please try that (e.g. win10 22h2). The issue may have something to do with the event loop implementation.

Initially I was debugging an electron 17 app and noticed the lack of autocompletion when the app was idling. I can repro that with the latest electron 34 (default built-in app, just "electron --inspect").

Please be aware that if the Node.js process is running a busy loop

In my repro example (just "node --inspect" or "electron --inspect") it is not running a busy loop. That would peg at least half a physical core.

would you mind sharing a minimum reproduction script

There is no repro script. Its just plain "node --inspect" or "electron --inspect". In both cases, the app is idling, event loop is waiting for events.

Since I observed the problem with plain node, that's what I focused on.

@bughit
Copy link
Author

bughit commented Jan 20, 2025

This is Chrome 132.0.6834.84 on win10 22h2 inspecting a plain "node --inspect" (v22.13.0).

Image

No autocompletion at idle.

@bughit
Copy link
Author

bughit commented Jan 20, 2025

would you mind sharing a minimum reproduction script that you are inspecting?

In case you're running a script and breaking, don't. Just run "node --inspect". The problem does not manifest on a breakpoint.

@targos
Copy link
Member

targos commented Jan 21, 2025

I can reproduce with the exact steps from the OP. @legendecas there is no script to run. The repro is node --inspect which opens the REPL.

@targos
Copy link
Member

targos commented Jan 21, 2025

Output with --trace-side-effect-free-debug-evaluate after writing global. (v23.6.0):

> [debug-evaluate] Checking function  for side effect.
000000A5F6443B01: [BytecodeArray]
 - map: 0x000b80481099 <Map(BYTECODE_ARRAY_TYPE)>
Parameter count 1
Register count 5
Frame size 40
         000000A5F6443B40 @    0 : 19 fe f7          Mov <closure>, r2
         000000A5F6443B43 @    3 : 19 02 f6          Mov <this>, r3
    0 E> 000000A5F6443B46 @    6 : 6b 01 f7 02       InvokeIntrinsic [_AsyncFunctionEnter], r2-r3
         000000A5F6443B4A @   10 : ca                Star0
         000000A5F6443B4B @   11 : 19 ff f7          Mov <context>, r2
    0 S> 000000A5F6443B4E @   14 : 21 00 00          LdaGlobal [0], [0]
         000000A5F6443B51 @   17 : c9                Star1
         000000A5F6443B52 @   18 : 81 01 02 39       CreateObjectLiteral [1], [2], #57
         000000A5F6443B56 @   22 : c7                Star3
         000000A5F6443B57 @   23 : 13 02             LdaConstant [2]
         000000A5F6443B59 @   25 : c6                Star4
         000000A5F6443B5A @   26 : 0b f8             Ldar r1
         000000A5F6443B5C @   28 : 3a f6 f5 00 03    DefineKeyedOwnPropertyInLiteral r3, r4, #0, [3]
         000000A5F6443B61 @   33 : 0b f6             Ldar r3
         000000A5F6443B63 @   35 : c6                Star4
         000000A5F6443B64 @   36 : 19 f9 f6          Mov r0, r3
         000000A5F6443B67 @   39 : 6b 03 f6 02       InvokeIntrinsic [_AsyncFunctionResolve], r3-r4
    6 S> 000000A5F6443B6B @   43 : af                Return
         000000A5F6443B6C @   44 : c6                Star4
         000000A5F6443B6D @   45 : 19 f9 f6          Mov r0, r3
         000000A5F6443B70 @   48 : 6b 02 f6 02       InvokeIntrinsic [_AsyncFunctionReject], r3-r4
         000000A5F6443B74 @   52 : af                Return
Constant pool (size = 3)
000000A5F6443AD9: [TrustedFixedArray]
 - map: 0x000b80480a39 <Map(TRUSTED_FIXED_ARRAY_TYPE)>
 - length: 3
           0: 0x000b80487881 <String[6]: #global>
           1: 0x000b80483b71 <ObjectBoilerplateDescription[0]>
           2: 0x000b804873d1 <String[12]: #.repl_result>
Handler Table (size = 16)
   from   to       hdlr (prediction,   data)
  (  14,  44)  ->    44 (prediction=4, data=2)
Source Position Table (size = 8)
0x00a5f6443b79 <Other heap object (TRUSTED_BYTE_ARRAY_TYPE)>
[debug-evaluate] failed runtime side effect check.

@targos targos removed the needs more info Issues without a valid reproduction. label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inspector Issues and PRs related to the V8 inspector protocol
Projects
None yet
Development

No branches or pull requests

3 participants