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 creates hundreds of recursive watchers in mono-repo when opening loose file #59985

Open
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 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

No response

💻 Code

🙁 Actual behavior

When VS Code is not having any workspace open and it is just used for loose files (aka "empty window"), open a TS file from a huge mono repo (outlook client for example, that consists of thousands of TS projects). Notice how hundreds of recursive file watchers are getting created for each and every TS project in that mono repo, even though I just opened a single loose file of that project.

🙂 Expected behavior

TS should only watch what it actually needs to watch. If I open a loose file of a project, do not recursively resolve every other TS project and install file watchers. Only do this up to the minimal extent needed.

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: 558, suspended: 47, polling: 47, failed: 0
- Non-Recursive Requests: total: 616, suspended: 28, polling: 26
- Recursive Watchers:     total: 511, active: 511, failed: 0, stopped: 0
- Non-Recursive Watchers: total: 588, active: 584, failed: 0, reusing: 4
- I/O Handles Impact:     total: 1168

//cc @sheetalkamat @DanielRosenwasser

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Sep 19, 2024
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 5.7.0 milestone Sep 19, 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