-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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 watcher resulting in high CPU use on Mac/Linux for large folders #3998
Comments
@bpasero i'll keep an eye on improving the scalability in chokidar to fit into the release. Let me know if you have a specific test repo (with large folders?) to check the performance. |
Some good ones are TypeScript (https://github.com/Microsoft/TypeScript) and of course the full Chromium workspace is probably the largest I know: https://chromium.googlesource.com/chromium/src.git |
Just checked TypeScript, it consumes around 80% of one core for ~2 seconds and then it's back to 0%. Cloning Chromium. |
Although when I'll investigate the new PR in chokidar too. |
is there some workarounds for now? I'm using a macbook air with the latest version of vscode |
@sibeliusseraphini there is a way to exclude large folders from watching in settings. It has a downside though that file events are no longer detected in those folders (e.g. the explorer might not update properly for that folder). |
is there a simple way of marking a folder as an excluded one? like in Webstom? it should also be possible to invalidate the cache/file watching or restart it as well |
Currently not. See http://code.visualstudio.com/updates/vMarch#_workbench and find |
Also ran into this issue when writing data to a gzip file, WatcherService uses about 75% CPU (a bit under one logical CPU/core). The file lives under my WSL home directory and I'm using Remote-WSL. Excluding EDIT: Excluding |
I also encountered this problem. The workaround (files.watcherExclude... ) worked, but is pretty well hidden. The Jetbrains IDE's has an entry in the context menu when clicking on a folder - maybe that would be a good idea for VS Code, too. |
I just had this issue suddenly start yesterday (May 5, 2021) in a 7.3 GB repo despite not having an issue for the past three years. I already have lots of properties within |
Why don't we migrate to some other file watcher service other than chokidar. Excluding the folders will hamper the file update processes. |
By debugging vscode's file-watcher code in the past I came to conclusion that this is what causes the problem. |
ran into this issue on a golang project with some recursive symlink folders inside it (my mac got VERY hot, which I guess was a good thing since I knew something was wrong) Adding the paths to Version: 1.57.1 |
Can we detect if it's a large folder, and decide whether we want to enable watcher accordingly? |
The |
Plan is to move to a new file watcher on all platforms that does:
[1] Tomorrows insider build will ship with the new watcher. |
Version: 1.62.0-insider (Universal) Not sure if this is the "tomorrow's build", but just downloaded and seeing this: That was asking VSC to monitor my entire ~ folder. A lot. If I narrow it to my dev work, it's pretty reasonable.... down to .1%, total cpu goes from 8% -> 2%. So, this appears to be addressing the problem on my machine... |
Today's insider build includes the new file watcher: https://code.visualstudio.com/insiders/ Linux users: when you configure
We have some cleverness to convert a exclude pattern such as |
Tested the master on Linux and this problem doesn't exist anymore. Thanks @bpasero and the devs for the efforts it was a real headache to kill it upon every startup. |
@bpasero Not sure if this is to be expected, but 1 of the two processes, is still using 17k file inotifys for me. The other 1 is recuded down to 3k when using the insider build. The process that is still using the 17k is started as soon as I open a typescript file within my project: The one that was actually reduced from 17k to 3k is: I am not sure if this is to be expected or this fixes only half of the problem? |
@jrmyio please protest in this issue microsoft/TypeScript#46351 |
We are using chokidar for file watching. Chokidar is known for performing bad over large folders (see paulmillr/chokidar#410). To investigate:
Workaround:
Find the large folders in your workspace and add them under the
files.watcherExclude
settingThe text was updated successfully, but these errors were encountered: