Skip to content

Chrome debugger for node doesn't work properly #33002

Description

@Aplet123
  • Version: v14.0.0
  • Platform: Linux my-computer 5.3.0-46-generic #38~18.04.1-Ubuntu SMP Tue Mar 31 04:17:56 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: Node debugger.

What steps will reproduce the bug?

  1. Run node --inspect to start the debugger in a REPL.
  2. Find the node instance under "Remote Target" and click "inspect".
  3. Type something in the chrome debugger and hit enter (e.g. 1+1).

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

It consistently happens for v14.0.0 but not for v13.13.0 or any prior version.

What is the expected behavior?

Output is immediately shown pressing enter in the chrome devtools.

What do you see instead?

The statement is executed but no output is shown until you open up the running node instance and hit enter in the REPL itself. For example, if you run console.log("foo") in the chrome devtools, you can see that "foo" is logged to both devtools and the node REPL. However, if you run 1+1, the return value 2 is not displayed on the devtools until you hit enter in the node REPL.

Additional information

My chrome version is 84.0.4115.5 (Official Build) dev (64-bit).

Activity

  1. wolfiehv commented on Apr 22, 2020

    @wolfiehv

    What steps will reproduce the bug?

    Same as above ( try to inspect anything in chrome debugger e.g. object )

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

    It consistently happens after updating node to version v14.0.0

    What is the expected behavior?

    Output is immediately shown pressing enter in the chrome devtools.

    What do you see instead?

    There is no output shown for a while. Then output appears.

    Additional information

    Version 81.0.4044.122 (Official Build) (64-bit)

    When i stopped on a breakpoint and then i type in debugger console everything works fine. As soon as I resume code execution in debugger and then I try to type in console it freezes for a few seconds again.

    My code

    globalThis.http_server = require('http').createServer((req, res) => {
    	res.end('works')
    }).listen(80, () => {
    	console.log('Server listening on port 80')
    	setTimeout(() => {
    		// debugger // optional
    	}, 1000)
    })
    

    Debugger screenshot
    image

    Problem seems to not occur when inspecting in terminal

  2. added
    inspectorIssues and PRs related to the V8 inspector protocol.
    on Apr 22, 2020
  3. targos commented on Apr 22, 2020

    @targos
    Member

    /cc @nodejs/inspector

  4. addaleax commented on May 8, 2020

    @addaleax
    Member

    I’ve confirmed that this was caused by #32523. This would fix the “not seeing any response” problem:

    diff --git a/src/env.cc b/src/env.cc
    index 3efa5c3b9c98..28dd4ceea3e3 100644
    --- a/src/env.cc
    +++ b/src/env.cc
    @@ -737,6 +737,9 @@ void Environment::RunAndClearInterrupts() {
     void Environment::RunAndClearNativeImmediates(bool only_refed) {
       TraceEventScope trace_scope(TRACING_CATEGORY_NODE1(environment),
                                   "RunAndClearNativeImmediates", this);
    +  HandleScope handle_scope(isolate_);
    +  InternalCallbackScope cb_scope(this, Object::New(isolate_), { 0, 0 });
    +
       size_t ref_count = 0;
     
       // Handle interrupts first. These functions are not allowed to throw

    However, I’m additionally seeing a segmentation fault inside V8 here occasionally that I’d like to investigate.

  5. roblav96 commented on May 21, 2020

    @roblav96

    @addaleax

    I too am experiencing this issue with node +14 rendering DevTools unusable. 😅

    OS: macOS High Sierra 10.13.6
    Shell: Bash 5.0.17
    Node: 14.3.0
    Npm: 6.14.5
    Chrome: 83.0.4103.61
    

    Steps to reproduce

    node --inspect -p 'setInterval(Function, 1 << 30)'
    • Open Google Chrome and enter chrome://inspect/#devices in the address bar
    • Click Open dedicated DevTools for Node
    • Type into the Console tab process.env

    You'll notice while typing process there is no autocomplete dropdown or eager evaluation. After pressing enter there's at least a few second delay until the expression is evaluated.

  6. june07 commented on Jul 3, 2020

    @june07

    Can also confirm that I'm seeing the same issue when using NiM https://chrome.google.com/webstore/detail/nodejs-v8-inspector-manag/gnhhdgbaldcilmgcpfddgdbkhjohddkj, and I'm using all DevTools versions, build in, appspot, and june07 hosted devtools instances:

    image
    image
    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    inspectorIssues and PRs related to the V8 inspector protocol.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions