Skip to content

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

@darthdeus

Description

@darthdeus
  • 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

Metadata

Metadata

Assignees

Labels

bugIssue identified by VS Code Team member as probable bugdebugDebug viewlet, configurations, breakpoints, adapter issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions