vscode: Unable to watch for file changes in this large workspace - not a large workspace.
- VSCode Version: 1.27.2
- OS Version: Ubuntu 18.04 bionic (x86-64)
Steps to Reproduce:
- Create a basic web project with a
node_modulesdirectory which exceeds the limit of file watchers: - Recursively count the number of files in the entire project directory using
find . -type f | wc -l - My project has
44452files (including directories). - Check current limit of file watchers using
cat /proc/sys/fs/inotify/max_user_watches - Make a note of the watcher limit of
8192 - Configure Visual Studio code to exclude the
node_modulesdirectory using
"files.watcherExclude": {
"**/node_modules/**": true
}
- Count files in only
node_modulesusingfind node_modules -type f | wc -l - Make a note of the file count:
43218 - Subtract the
node_modulesfile count (43218) from project file count (44452) 44452 - 43218 = 12341234is well within the watcher limit of8192.- If VS Code honours
watcherExclude, it must only watch1234files. - VS Code still complains it’s “Unable to watch for file changes in this large workspace”.
Does this issue occur when all extensions are disabled?: Yes
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 19
- Comments: 45 (11 by maintainers)
Same here too. VS Code 1.30.1 and only 41 files outside node_modules folder.
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.
Happy Coding!
@bpasero If you don’t mind my asking, what more information is needed for this issue?
Just a follow up on this, I have a project with 104 files where Code is configured to ignore node_modules and some other directories and I am seeing this usage:
Holy smokes! That’s a lot of file watchers for 104 files. Clearly, this editor is not intended for large projects.
Confirming similar issue in Ubuntu 18.04. And when I had VSCode running I couldn’t start my webpack dev server because there were no available watchers. I had to kill VSCode and work from Sublime Text to continue working.
I just ran into this issue as well, and it’s rather annoying because I use watchers for other things like compiling latex. I am not sure this is a factor, but it is possible that another development tool (eg. webpack) is using up resources.
Hi @bpasero – sorry for the radio silence. I will run chokidar and test it out for you. Just been crazy busy lately. I hope to get to this by the weekend. Thanks for the help.
Still happens when no app is running. For more context, this is a fresh install of Linux Mint 19.2. So not only is there not another app running, there are barely any other apps installed. I was running Mint 17.3 for a long time (Ubuntu 14.04 equivalent) with VSCode and had no issues (never changed the amount of watchers). Yesterday I performed a completely fresh install of Mint 19.2 and VSCode was one of the first things I installed and I see the warning every time, even with only 4 files. Also, to answer your other question, I haven’t changed my configured limit, so it’s at the default value of 8192. But that should handle 4 files just fine. Also, as I mentioned, I never had to change that configuration when I was on Mint 17.3 and I habitually had 6+ apps running at the same time as VSCode. Seems like every Linux person on this thread who is reporting OS version is either Mint 19 or Ubuntu 18. Do you guys at MS have a machine with one of those versions to see if you can reproduce?
Same issue for me as well on Ubuntu 18.04.
Version: 1.31.1 Commit: 1b8e8302e405050205e69b59abb3559592bb9e60 Date: 2019-02-12T02:19:29.629Z Electron: 3.1.2 Chrome: 66.0.3359.181 Node.js: 10.2.0 V8: 6.6.346.32 OS: Linux x64 4.18.0-15-generic
I ran the commands @jackwootton posted with some modifications. At first, I wasn’t getting any results back from running the command (same as @jackwootton). After some tinkering, I realized I needed to change the awk pattern from
/anon_inode/to/a_inode/and finally got some results.Commands I ran:
Results:
So, it appears vscode has launched two processes - the first (4679) having 4565 inotify monitored files and the second (4719) having 3301 inotify monitored files. My project only contains ~30 files.
Just to be sure, I disabled all the extensions, shut down vscode, and re-ran the above commands - no vscode processes where found, as expected.
I then relaunched vscode, leaving the extensions disabled, and opened my project folder again. I added an empty .js file and immediately received the ‘unable to watch for file changes’ warning. I then re-ran the above commands and got a similar result to the first run:
And just to make sure things matched, I did a line count on
/proc/12867/fdinfo/21and it did indeed contain 4565 inotify entries. Here’s a sample:Also happening for me on Linux Mint 19.1 with a single folder and
Version: 1.31.1 Commit: 1b8e8302e405050205e69b59abb3559592bb9e60 Date: 2019-02-12T02:19:29.629Z Electron: 3.1.2 Chrome: 66.0.3359.181 Node.js: 10.2.0 V8: 6.6.346.32 OS: Linux x64 4.15.0-45-generic
Could background compilation in watch mode be the culprit?
@pascollin This could be an effect of another editor or watch tool being open. e.g.
sublime_text,webpack watch,cpxe.t.c There is a nice script you can execute first for finding which process is consuming most of the watches. Then you can shut it down to focus on testingvscode.Well, but only with a VSCode workspace which has thousands of files.
Yeah, can you locally clone https://github.com/paulmillr/chokidar and run it to watch a simple small folder and see if you get the same folder? Instructions are at https://github.com/paulmillr/chokidar#api
I believe I’m seeing the same thing on Fedora 29. To add some details, I have a folder containing 255 files, excluding node_modules. This is what I’m seeing for inotify consumption for Code:
This seems awfully high for just 255 files.
@bpasero it’s single folder I guess. I opened folder using Code.