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

process.report.getReport is very slow when called in Extension Host, blocks most functionality #238607

Open
jakebailey opened this issue Jan 23, 2025 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug confirmed Issue has been confirmed by VS Code Team member extension-host Extension host issues freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues linux Issues with VS Code on Linux nodejs NodeJS support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream windows VS Code on Windows issues
Milestone

Comments

@jakebailey
Copy link
Member

Does this issue occur when all extensions are disabled?: Yes/No

Version: 1.97.0-insider (user setup)
Commit: cc14c75
Date: 2025-01-23T10:37:55.126Z
Electron: 32.2.7
ElectronBuildId: 10660205
Chromium: 128.0.6613.186
Node.js: 20.18.1
V8: 12.8.374.38-electron.0
OS: Windows_NT x64 10.0.26100

Steps to Reproduce:

  1. Clone https://github.com/jakebailey/vscode-getreport-issue
  2. Run the extension
  3. Run the "Hello World" command
  4. Attempt to do anything with the editor

Image

I discovered this as part of dprint/dprint-vscode#99; for months my editor has been unresponsive at startup, unable to hover or even copy and paste now that there are paste providers, and this particular call is the culprit.

If I run Node directly, or call VS Code "as node", it does not exhibit these problems. My impression is that this has to do with VS Code patching all of the networking calls, since unfortunately getReport calls to the network (even though effectively all users use it to check if libc is musl or not).

Related: nodejs/node#55576

@deepak1556
Copy link
Collaborator

Thanks for the concise repro, I will try backporting the upstream fix and see if that helps.

@deepak1556 deepak1556 added bug Issue identified by VS Code Team member as probable bug upstream Issue identified as 'upstream' component related (exists outside of VS Code) freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues extension-host Extension host issues nodejs NodeJS support issues upstream-issue-linked This is an upstream issue that has been reported upstream labels Jan 24, 2025
@deepak1556 deepak1556 added this to the February 2025 milestone Jan 24, 2025
@bpasero bpasero removed their assignment Jan 24, 2025
@deepak1556 deepak1556 added confirmed Issue has been confirmed by VS Code Team member linux Issues with VS Code on Linux windows VS Code on Windows issues labels Jan 24, 2025
@deepak1556
Copy link
Collaborator

If I run Node directly, or call VS Code "as node", it does not exhibit these problems. My impression is that this has to do with VS Code patching all of the networking calls, since unfortunately getReport calls to the network (even though effectively all users use it to check if libc is musl or not).

If you have an open network socket, ex: a http request with keep alive then it should repro with vanilla node as well.

Reading the relevant Node.js issue and the fix, it seems the extension still needs to call process.report.excludeNetwork = true to avoid the expensive dns resolution calls if they are not interested in the info.

I would also need to backport nodejs/node#55602 so that excludeNetwork covers all cases.

But I don't see how we can completely avoid this issue,

  1. Track and proactively reach out to extensions making report api calls with network info
  2. Flip the default of excludeNetwork in the extension host (this would be a breaking change)

/cc @chrmarti @alexdima

@jakebailey
Copy link
Member Author

If you have an open network socket, ex: a http request with keep alive then it should repro with vanilla node as well.

Interesting; this vaguely reminds me of nodejs/node#47228

The hang requiring some other ongoing request sort of explains why this happens to me more consistently when Copilot is enabled...

@jakebailey
Copy link
Member Author

jakebailey commented Jan 24, 2025

If this is a bug with keepAlive, it doesn't feel like excluding the network stuff would be the "right" fix, of course. But I also doubt it would actually hurt anything...

(This issue doesn't affect me anymore since dprint changed was modified to not use this call when possible)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug confirmed Issue has been confirmed by VS Code Team member extension-host Extension host issues freeze-slow-crash-leak VS Code crashing, performance, freeze and memory leak issues linux Issues with VS Code on Linux nodejs NodeJS support issues upstream Issue identified as 'upstream' component related (exists outside of VS Code) upstream-issue-linked This is an upstream issue that has been reported upstream windows VS Code on Windows issues
Projects
None yet
Development

No branches or pull requests

3 participants