question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Node debugging extremely slow on startup and after first breakpoint

See original GitHub issue

Description ExpressJS application becomes unresponsive for a long time whenever VSCode debugger is attached to the application. The application works as expected and starts up instantly when run normally in a terminal (node dist/server.js) or using node default debugger (node inspect dist/server.js). Just a note that the Express JS application in context here isn’t super resource intensive, just some basic CRUD operations and debugging experience on VSCode on other low specs Linux machines is seamless and has no such issue. The issue only occurs whenever VSCode’s debugger is attached to the application, be it in any form (launch configuration, javascript debug terminal or node process attach).

Here is the full debugging scenario for more context on the issue

  1. If the application is launched using the launch configuration the application won’t start instantly (i.e. if I goto localhost:3000 the browser will stuck loading for 2-3 mins), it eventually starts and the first breakpoint is hit but once I step forward in the debugger nothing happens and I have to wait 1-2 mins to reach the next line, after that the debugger works normally. So the main issue is the unresponsive behaviour on attaching debugger and after step over the first breakpoint.
  2. Now if I start the application normally in the terminal, it starts working the browser almost instantly, now once I attach VSCode debugger to the node process and hit any of the application endpoint it hangs and I’ll have to wait for the debugger to hit the first breakpoint, and then again wait after stepping forward from the first breakpoint. After this things work normally without any waiting times.

To Reproduce

  1. Run an express JS application with the following run configurations
{
    "configurations": [
// for scenario 2 listed above
        {
            "name": "Attach by Process ID",
            "processId": "${command:PickProcess}",
            "request": "attach",
            "skipFiles": [
                "<node_internals>/**",
                "${workspaceFolder}/node_modules/**/*.js",
            ],
            "sourceMaps": true,
            "trace": true,
            "type": "pwa-node"
        },
// for scenario 1 listed above
        {
            "type": "pwa-node",
            "request": "launch",
            "name": "Debug with watch task",
            "skipFiles": [
                "<node_internals>/**",
                "${workspaceFolder}/node_modules/**/*.js"
            ],
            "program": "${workspaceFolder}/dist/server.js",
            "outFiles": [
                "${workspaceFolder}/dist/**/*.js"
            ],
            "sourceMaps": true,
            "trace": true,
            "preLaunchTask": "tsc: watch - tsconfig.json"
        }
    ]
}

Log File

VS Code Version:

Version: 1.63.2
Commit: 899d46d82c4c95423fb7e10e68eba52050e30ba3
Date: 2021-12-15T09:38:17.605Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Darwin arm64 21.2.0

Additional context Machine Specs Screenshot 2022-01-16 at 2 10 20 PM

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:3
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
connor4312commented, Jan 18, 2022

Does this issue go away if you remove ${workspaceFolder}/node_modules/**/*.js from your skipFiles?

2reactions
gonzalo-lorietocommented, May 18, 2022

It’s a bug thing 🙂 I will most likely fix this the first week of Feb.

👀

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Nodejs --debug-brk extremely slow - Stack Overflow
Show activity on this post. I'm using node v6. 10.0 and trying to figure out why my --debug-brk is so incredibly slow. Without...
Read more >
Debugger is extremely slow to start w/ Node.js 5.0.0 - YouTrack
I'm running WebStorm EAP 11.0.2 and NodeJS 5.1, and seeing this issue. Debugger takes 30+ seconds to spin up.
Read more >
Node debugger too heavy & slow? Try dbgr ⚡️ - Reddit
When you're debugging something heavy with slow startup (eg. server, headless Chrome, etc), you want to use something simple & light to debug....
Read more >
Debug Node.js Apps using Visual Studio Code
Set breakpoints, step-in, inspect variables and more. ... Setting up a project for Node.js debugging is straightforward with VS Code providing appropriate ...
Read more >
Improve start up time - Visual Studio (Windows) | Microsoft Learn
Visual Studio is designed to start up as quickly and efficiently as ... If Visual Studio detects slow startup, a pop-up message appears, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found