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

File watching is registering thousands of redundant watchers #59984

Open
bpasero opened this issue Sep 16, 2024 · 0 comments
Open

File watching is registering thousands of redundant watchers #59984

bpasero opened this issue Sep 16, 2024 · 0 comments
Assignees
Labels
Needs Investigation This issue needs a team member to investigate its status.

Comments

@bpasero
Copy link
Member

bpasero commented Sep 16, 2024

🔎 Search Terms

file watcher performance efficiency watching events

🕗 Version & Regression Information

I am not sure when this changed, but ever since typescript.tsserver.experimental.useVsCodeWatcher was added it becomes more visible now, at least to me as owner of the file watcher component in VS Code.

⏯ Playground Link

https://github.com/Microsoft/vscode/

💻 Code

No response

🙁 Actual behavior

When you open vscode repository (https://github.com/Microsoft/vscode/) and open a TS file (e.g. vs/base/strings.ts) and wait a bit until the TS/JS language service has settled, notice how there are the following recursive file watchers:

  • node_modules
  • src/vs
  • src/@bpasero, src/node:vm, src/fs,... (actually 83 more for each and every module we depend on, these folders do not exist on disk)

And then there are >4000 (!) requests for non-recursive files for pretty much every single TS file in the project (for example src/vs/base/browser/ui/menu/menu.ts).

Image

🙂 Expected behavior

A lot less requests for watching:

  • all of the thousands of non-recursive watch requests are obsolete given you watch src/vs already recursively
  • paths like src/fs are made up and do not exist, I am not even sure how it would make sense to watch src/<node module>?

Additional information about the issue

Here is how you can see the data:

  • after you have opened vscode and a TS file, select "Set Log Level" and pick "Trace" from the command picker
  • in the output panel, select the "File Watcher" channel
  • you should see output like this:
[File Watcher] request stats:

[Summary]
- Recursive Requests:     total: 89, suspended: 85, polling: 2
- Non-Recursive Requests: total: 4344, suspended: 50, polling: 0
- Recursive Watchers:     total: 4, active: 4, failed: 0, stopped: 0
- Non-Recursive Watchers: total: 4294, active: 10, failed: 1, reusing: 4283
- I/O Handles Impact:     total: 16

//cc @sheetalkamat @DanielRosenwasser

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Sep 16, 2024
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 5.7.0 milestone Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
Development

No branches or pull requests

3 participants