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

Node debugger attaches to NPM much slower than to node with restart: true #95128

Closed
darthdeus opened this issue Apr 13, 2020 · 3 comments
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues

Comments

@darthdeus
Copy link

darthdeus commented Apr 13, 2020

  • VSCode Version: Version: 1.43.2 (system setup) Commit: 0ba0ca52957102ca3527cf479571617f0de6ed50 Date: 2020-03-24T07:38:38.248Z Electron: 7.1.11 Chrome: 78.0.3904.130 Node.js: 12.8.1 V8: 7.8.279.23-electron.0 OS: Windows_NT x64 10.0.18362
  • OS Version: Windows 10

Steps to Reproduce:

Using the provided nodemon launch configuration with restart: true attaches very quickly

{
  "type": "node",
  "request": "launch",
  "name": "nodemon",
  "runtimeExecutable": "nodemon",
  "program": "${workspaceFolder}/server.js",
  "restart": true,
  "console": "integratedTerminal",
  "internalConsoleOptions": "neverOpen",
  "skipFiles": ["<node_internals>/**"]
}

On the other hand, if I launch a very similar configuration with NPM it will attach very slowly. (npm run debug is simply nodemon --inspect server.js).

{
  "type": "node",
  "request": "launch",
  "name": "nodemon npm",
  "runtimeExecutable": "npm",
  "runtimeArgs": ["run", "debug"],
  "port": 9229,
  "restart": true,
  "skipFiles": ["<node_internals>/**"],
  "console": "integratedTerminal",
  "internalConsoleOptions": "neverOpen"
}

In the case of my code (using ApolloServer), the difference is quite significant, as in the first case if I make a request it will hit the breakpoint, but in the second case it takes sometimes over 5 seconds and I can get many requests in before the breakpoint is triggered.

What is even more surprising, is that the console prints Debugger attached, yet I can issue multiple requests over a period of few seconds when the breakpoint is still not hit.

Does this issue occur when all extensions are disabled?: N/A

@vscodebot
Copy link

vscodebot bot commented Apr 13, 2020

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@roblourens
Copy link
Member

roblourens commented Apr 15, 2020

I see the bug in node2, but FYI @connor4312 the npm launch config does not seem to work with js-debug, breakpoints never bind.

@connor4312
Copy link
Member

js-debug not working is due to the --inspect flag. Removing it makes inspection work:

I've seen this a few times but never root caused it. It seems like it's actually caused by a Node.js bug (linked above).

@connor4312 connor4312 added bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues labels Apr 22, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Jun 7, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues
Projects
None yet
Development

No branches or pull requests

3 participants