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 debugger for node doesn't work properly #33002

Closed
Aplet123 opened this issue Apr 22, 2020 · 5 comments
Closed

Chrome debugger for node doesn't work properly #33002

Aplet123 opened this issue Apr 22, 2020 · 5 comments
Labels
inspector Issues and PRs related to the V8 inspector protocol

Comments

@Aplet123
Copy link

  • 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).

@wolfiehv
Copy link

wolfiehv commented Apr 22, 2020

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

@targos targos added the inspector Issues and PRs related to the V8 inspector protocol label Apr 22, 2020
@targos
Copy link
Member

targos commented Apr 22, 2020

/cc @nodejs/inspector

@addaleax
Copy link
Member

addaleax commented May 8, 2020

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.

@roblav96
Copy link

@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.

@june07
Copy link

june07 commented Jul 3, 2020

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

addaleax added a commit to addaleax/node that referenced this issue Jul 14, 2020
This ensures that microtasks scheduled by native immediates are run
after the tasks are done. In particular, this affects the inspector
integration since 6f9f546.

Fixes: nodejs#33002
Refs: nodejs#32523
MylesBorins pushed a commit that referenced this issue Jul 20, 2020
This ensures that microtasks scheduled by native immediates are run
after the tasks are done. In particular, this affects the inspector
integration since 6f9f546.

Fixes: #33002
Refs: #32523

PR-URL: #34366
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: James M Snell <[email protected]>
cjihrig pushed a commit that referenced this issue Jul 23, 2020
This ensures that microtasks scheduled by native immediates are run
after the tasks are done. In particular, this affects the inspector
integration since 6f9f546.

Fixes: #33002
Refs: #32523

PR-URL: #34366
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: James M Snell <[email protected]>
addaleax added a commit to addaleax/node that referenced this issue Sep 23, 2020
This ensures that microtasks scheduled by native immediates are run
after the tasks are done. In particular, this affects the inspector
integration since 6f9f546.

Fixes: nodejs#33002
Refs: nodejs#32523

PR-URL: nodejs#34366
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: James M Snell <[email protected]>
addaleax added a commit that referenced this issue Sep 23, 2020
This ensures that microtasks scheduled by native immediates are run
after the tasks are done. In particular, this affects the inspector
integration since 6f9f546.

Fixes: #33002
Refs: #32523

Backport-PR-URL: #35241
PR-URL: #34366
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: James M Snell <[email protected]>
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

Successfully merging a pull request may close this issue.

6 participants