-
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
"Unable to watch for file changes in this large workspace folder" #151827
Comments
Version: 1.68.1 VSCode file watching on Linux has become "hot garbage" in the last couple/few months. I hate to pile on here, but it is becoming unusable and cranking up the inotify max_user_watches beyond 65K is NOT a solution/workaround. I'm a Python/Ansible user and maintain a couple hundred Ansible playbook, inventory, and role projects (each their own Git repo/project). At one time, I used to be able to "open folder" and open my "roles" directory (133 sub-folders, each a Git project) without hitting this issue. Now, I "open folder" on a single role and my watches count will easily hit 22K for an individual instance of VSCode running, no matter how many files are contained in the folder. I've tried "open workspace" instead of "open folder", as I've read that can help, but the problem persists. As I author this comment, I currently have a single VSCode window opened via the "open workspace" method. Using this script: !/bin/bash
echo "number of files in cwd:"
find . -type f | wc -l
echo "directories with most files:"
find . -xdev -type d -print0 |
while IFS= read -d '' dir; do
echo "$(find "$dir" -maxdepth 1 -print0 | grep -zc .) $dir"
done |
sort -rn |
head -50 I see that there are: number of files in cwd:
3785
directories with most files:
259 ./.git/objects
26 ./.git/objects/91
25 ./.git/objects/73
25 ./.git/objects/3b
24 ./.git/objects/da
24 ./.git/objects/a7
# snipped for brevity
19 ./.git/objects/6f
19 ./.git/objects/5b So nearly 3800 files, the majority being Git objects (which should be excluded by default, right?). However using this script to show current inotify consumers (https://github.com/fatso83/dotfiles/blob/master/utils/scripts/inotify-consumers): (venv3_ansible-4.2.0) ben@knedmhils042:~/workspace/kiewit/ansible/inventories$ ~/bin/inotify-consumers.sh
INOTIFY INSTANCES
WATCHES PER
COUNT PROCESS PID USER COMMAND
------------------------------------------------------------
15854 2 422034 ben /usr/share/code/code --ms-enable-electron-run-as-node /usr/share/code/resources/app/out/bootstrap-fork --type=fileWatcher
5976 2 422020 ben /usr/share/code/code --ms-enable-electron-run-as-node --inspect-port=0 /usr/share/code/resources/app/out/bootstrap-fork --type=extensionHost --skipWorkspaceStorageLock
# snipped for brevity There are a few other VSCode related entries in the output in the single digits, but the top two are the main offenders. According to this (https://github.com/microsoft/vscode/wiki/File-Watcher-Issues), it seems that these two offenders correspond to nodejs My user-level (and at times duplicated for the workspace itself) VSCode settings is configured as follows to try to get a handle on this: "files.watcherExclude": {
"**/collections/**": true,
"**/collections/*/**": true,
"**/molecule/reports/**": true,
"**/molecule/reports/*/**": true,
"**/molecule/resources/**": true,
"**/molecule/resources/*/**": true,
"**/roles/**": true,
"**/roles/*/**": true,
"collections/**": true,
"molecule/reports/**": true,
"molecule/resources/**": true,
"roles/**": true
}, As you can see, I've tried every glob pattern I can think of with no relief. Immediately after opening VSCode, I set logs to trace, toggled dev tools and filtered for TRACE [File Watcher (node.js)] Request to start watching: /home/ben/workspace/kiewit/ansible/collections/ac_kiewit_content (excludes: <none>, includes: **/.git/objects/**,**/.git/subtree-cache/**,**/node_modules/*/**,**/.hg/store/**,**/collections/**,**/collections/*/**,**/molecule/reports/**,**/molecule/reports/*/**,**/molecule/resources/**,**/molecule/resources/*/**,**/roles/**,**/roles/*/**,collections/**,molecule/reports/**,molecule/resources/**,roles/**)
log.ts:289 TRACE [File Watcher (node.js)] Started watching: '/home/ben/workspace/kiewit/ansible/collections/ac_kiewit_content' Followed by this: Extension Host
log.ts:289 TRACE [File Watcher (parcel)] Request to start watching: /home/ben/venv3_ansible-4.2.0/lib/python3.8/site-packages (excludes: **/.git/objects/**,**/.git/subtree-cache/**,**/node_modules/*/**,**/.hg/store/**,**/collections/**,**/collections/*/**,**/molecule/reports/**,**/molecule/reports/*/**,**/molecule/resources/**,**/molecule/resources/*/**,**/roles/**,**/roles/*/**,collections/**,molecule/reports/**,molecule/resources/**,roles/**, includes: <all>),/usr/lib/python3.8 (excludes: **/.git/objects/**,**/.git/subtree-cache/**,**/node_modules/*/**,**/.hg/store/**,**/collections/**,**/collections/*/**,**/molecule/reports/**,**/molecule/reports/*/**,**/molecule/resources/**,**/molecule/resources/*/**,**/roles/**,**/roles/*/**,collections/**,molecule/reports/**,molecule/resources/**,roles/**, includes: <all>)
log.ts:289 TRACE [File Watcher (parcel)] Started watching: '/home/ben/venv3_ansible-4.2.0/lib/python3.8/site-packages' with backend 'inotify' and native excludes '/home/ben/venv3_ansible-4.2.0/lib/python3.8/site-packages/.git/objects, /home/ben/venv3_ansible-4.2.0/lib/python3.8/site-packages/.git/subtree-cache, /home/ben/venv3_ansible-4.2.0/lib/python3.8/site-packages/node_modules, /home/ben/venv3_ansible-4.2.0/lib/python3.8/site-packages/.hg/store, /home/ben/venv3_ansible-4.2.0/lib/python3.8/site-packages/collections, /home/ben/venv3_ansible-4.2.0/lib/python3.8/site-packages/molecule/reports, /home/ben/venv3_ansible-4.2.0/lib/python3.8/site-packages/molecule/resources, /home/ben/venv3_ansible-4.2.0/lib/python3.8/site-packages/roles'
TRACE [File Watcher (parcel)] Started watching: '/usr/lib/python3.8' with backend 'inotify' and native excludes '/usr/lib/python3.8/.git/objects, /usr/lib/python3.8/.git/subtree-cache, /usr/lib/python3.8/node_modules, /usr/lib/python3.8/.hg/store, /usr/lib/python3.8/collections, /usr/lib/python3.8/molecule/reports, /usr/lib/python3.8/molecule/resources, /usr/lib/python3.8/roles' Is it me, or is nodejs # current/active virtual env file count
(venv3_ansible-4.2.0) ben@knedmhils042:~/venv3_ansible-4.2.0$ ~/bin/dirs_with_files.sh
number of files in cwd:
72322
directories with most files:
896 ./lib/python3.8/site-packages/ansible_collections/fortinet/fortimanager/plugins/modules
895 ./lib/python3.8/site-packages/ansible_collections/fortinet/fortimanager/plugins/modules/__pycache__
# snipped for brevity # system Python file count
(venv3_ansible-4.2.0) ben@knedmhils042:/usr/lib/python3.8$ ~/bin/dirs_with_files.sh
number of files in cwd:
1334
directories with most files:
206 .
175 ./__pycache__
# snipped for brevity I made the switch to VSCode years ago and truly have loved using it. But the past couple/few months have been a real struggle. I typically have 2 or 3 instances of VSCode running at once (due to the inter-related nature of the things I work on), but having a 3rd instance up is guaranteed to hit the I think I read somewhere about a new unified file watcher implementation vs. maintaining different ones for Windows, Linux, Mac and I certainly hope that is on its way and can provide some relief. |
This bit me today like one of those bear trap claws. @watsonb, my logs also point to the "parcel" file watcher backend. If I'm not mistaken, that replaced vscode's old file watcher sometime in the last 6-12 months. Thankfully, the fix 🤞 is planned for the August 2022 release. |
@denosaurtrain let's hope there is some relief soon. |
I should say at least on Ubuntu the bug still exists. I run VSCode in a container, so couldn't increase watches number, the root system is huge but mostly mounted read only. The only |
Yup, the situation is the same AFAIK. TL;DR: VS Code's new default watcher implementation, parcel-bundler/watcher#64 was included in the August and September iteration plans, but the issue is not resolved yet and not included in the October iteration plan. Assuming that means it was dropped or postponed, I'm not sure why, nor do I know who to ask about it. For some users, myself included, an acceptable workaround is to increase Caveat: Take my statements in this comment with a grain of salt. I'm sharing what I've gleaned from my research and testing of the issue, but I'm not "in the know" about any of this, and I could be completely off-base. |
I must admit that due to this issue I had to vscode downgrade to 1.70 :-( |
/duplicate #137872 |
Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for similar existing issues. See also our issue reporting guidelines. Happy Coding! |
Issue Type: Bug
When opening
a typescripta(n empty) folder I get the error message:But it is not large at all. In fact it is enough to have
only onenot a single file in the "project" folder!Now opening this
empty
folder in VSCode leeds to the mentioned error message.Before you ask:
and it does not help if set to the 512K maximum.
Findings:
.git
folder - that does not exist in theempty
"project"..git
folder.$HOME
is managed by git (for dotfiles mainly), so I have a.git
directory in it.~/.git
the error does not appear when opening theempty
folder w/ VSCode.git init
in theempty
folder.Looks like the watcher is climbing up the folder structure until it finds a
.git
folder - in my case up to the$HOME
directory that naturally contains a lot of files. This does not seem to make much sense as the.git
folder does not necessarily belongs to the actual project.I did not have the issue when I installed typescript (4.7.3) in the
empty
folder, created a propertsconfig.json
and rannpx tsc -w
, so the error does not seem to come from the original ts watcher.I am not sure if this is really a VSCode issue or comes from some component used by VSC.
VS Code version: Code 1.68.0 (4af164e, 2022-06-08T11:49:57.055Z)
OS version: Linux x64 5.3.18-150300.59.68-default
Restricted Mode: No
System Info
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
rasterization: disabled_software
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Extensions (23)
(2 theme extensions excluded)
The text was updated successfully, but these errors were encountered: