Open TCROC opened 1 year ago
Any updates on this issue? Are there any configs where I can manually tell the language server which file extensions to watch?
FYI @chzuluag @AArnott Can you help with this issue? I'd like to figure out who is watching all these files.
I'm also more than happy to hop on a call and share my screen / show what is happening on my end if you have any trouble reproducing.
I've tested it on POP OS (an Ubuntu derivative) and Ubuntu 22.04. Occurs on both.
Just checking in again on this issue. Any updates?
@lifengl may own the watcher.
Any updates on this issue?
we use the NET Core FileSystemWatcher on the NET Core project side, which does not provide an exclusion pattern. It fits windows well, but would not use watcherExclude on Linux. We do consider to have an option to use the vscode watcher and forwards events through process boundaries. It would come with overhead unless user sets watcherExclude well, but it would support certain scenarios better (like a remote share, where file system doesn't provide native supports).
the exclusion list does come with its own problem. Running nuget restore, which will update a few files inside obj folder, which can be easily excluded, and in the pasted sample, the obj folder is excluded. So without some compensation, the project system would miss event to update language service after NuGet restore is done. It could lead projects to be out of dated, or the spinning of project loading never ends.
@chzuluag offered help to take a look this.
Checking in to see if there are any updates on this :)
@TCROC I'm right now working on a solution to enable VS Code File Watchers on the extension. Once the Vs Code file watcher is enabled, we won't listen to changes in paths included in the files.watcherExclude setting. I'll reach out once this change is ready.
@chzuluag That is great to hear! I look forward to testing it out! :)
This change is now available in C# Dev Kit prerelease v0.5.98. you can enable the following workspace setting so your exclusion list (files.watcherExclude) is honored by the extension.
Perfect! I will test this out as soon as my extension updates! :)
@chzuluag I just updated my extension to version: v0.5.127
. The issue is still present. My "files.watcherExclude" is still the same as above and I am still getting the "Unable to watch for changes..." error. I ran the "inotify-info" script and files that should be ignored are still being watched:
...
58872411 [259:6] /home/tcroc/dev/BlockyBall/Library/ShaderCache/vfx/ball-Explodea206/04/
58872412 [259:6] /home/tcroc/dev/BlockyBall/Library/ShaderCache/vfx/wall_red478d/04/
58872413 [259:6] /home/tcroc/dev/BlockyBall/Library/ShaderCache/vfx/Smokeccec/04/
58872414 [259:6] /home/tcroc/dev/BlockyBall/Library/ShaderCache/vfx/wall_blue1dc0/04/
58873728 [259:6] /home/tcroc/dev/BlockyBall/.git/modules/Packages/com.langestudios.playfabmirror/objects/43/
58873730 [259:6] /home/tcroc/dev/BlockyBall/.git/modules/Packages/com.langestudios.playfabmirror/objects/e2/
58873732 [259:6] /home/tcroc/dev/BlockyBall/.git/modules/Packages/com.langestudios.playfabmirror/objects/72/
58873734 [259:6] /home/tcroc/dev/BlockyBall/.git/modules/Packages/com.langestudios.playfabmirror/objects/67/
58873736 [259:6] /home/tcroc/dev/BlockyBall/.git/modules/Packages/com.langestudios.playfabmirror/objects/b0/
58873738 [259:6] /home/tcroc/dev/BlockyBall/.git/lfs/objects/ff/80/
58875285 [259:6] /home/tcroc/dev/BlockyBall/Library/ShaderCache/shadergraph/DefaultVFXSG8c1e/00/
58994130 [259:6] /home/tcroc/dev/BlockyBall/Library/StateCache/PrefabStageHierarchy/ea/
...
There's a lot more, but that was a quick copy + paste showing that the watcherExclude is still not being respected.
And I have both my "User" and "Workspace" settings configured as you instructed above:
So I believe this issue should be reopened as the new setting does not appear to work.
Thanks for the effort on this!
And this is my settings.json file for my workspace:
{
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true,
"**/.hg/store/**": true,
"**/.DS_Store":true,
"**/.git/**":true,
"**/.gitmodules":true,
"**/*.booproj":true,
"**/*.pidb":true,
"**/*.suo":true,
"**/*.user":true,
"**/*.userprefs":true,
"**/*.unityproj":true,
"**/*.dll":true,
"**/*.exe":true,
"**/*.pdf":true,
"**/*.mid":true,
"**/*.midi":true,
"**/*.wav":true,
"**/*.gif":true,
"**/*.ico":true,
"**/*.jpg":true,
"**/*.jpeg":true,
"**/*.png":true,
"**/*.psd":true,
"**/*.tga":true,
"**/*.tif":true,
"**/*.tiff":true,
"**/*.3ds":true,
"**/*.3DS":true,
"**/*.fbx":true,
"**/*.FBX":true,
"**/*.lxo":true,
"**/*.LXO":true,
"**/*.ma":true,
"**/*.MA":true,
"**/*.obj":true,
"**/*.OBJ":true,
"**/*.cubemap":true,
"**/*.flare":true,
"**/*.mat":true,
"**/*.meta":true,
"**/*.unity":true,
"**/*.prefab":true,
"**/*.asmdef":true,
"build/":true,
"Build/":true,
"Library/":true,
"library/":true,
"obj/":true,
"Obj/":true,
"temp/":true,
"Temp/":true,
"**/Gitignore/**":true,
"**/builds/**":true
},
"dotnet.defaultSolution": "BlockyBall.sln",
"dotnet.preferVisualStudioCodeFileSystemWatcher": true
}
@TCROC I'm sorry to hear this is not working as expected. I'll take a look to understand what else is going on.
Does ./inotify-info
show you the list of processes holding these watchers?
@chzuluag yep. When running ./inotify-info
, it appears that Microsoft.VisualStudio.Code.ServiceHost
, rzls
, and Microsoft.VisualStudio.Code.Server
are the biggest offenders.
This is the full output:
------------------------------------------------------------------------------
INotify Limits:
max_queued_events 16384
max_user_instances 128
max_user_watches 524288
------------------------------------------------------------------------------
Pid Uid App Watches Instances
78788 1000 Microsoft.VisualStudio.Code.ServiceHost 327845 13
78286 1000 rzls 146826 3
78661 1000 Microsoft.VisualStudio.Code.Server 48944 3
4310 1000 tracker-miner-fs-3 200 1
4191 1000 systemd 161 3
5016 1000 xdg-desktop-portal-gnome 47 1
77832 1000 code 43 1
5048 1000 gsd-xsettings 38 1
5083 1000 xdg-desktop-portal-gtk 37 1
4454 1000 gnome-shell 14 1
4603 1000 gvfsd-trash 11 1
4436 1000 gnome-session-binary 10 2
20627 1000 firefox-bin 10 1
4682 1000 io.elementary.appcenter 10 1
77552 1000 code 9 3
5166 1000 zeitgeist-fts 9 1
4672 1000 evolution-alarm-notify 9 1
4700 1000 Discord 5 2
4856 1000 mailspring 5 2
5241 1000 gjs-console 4 1
5221 1000 mailspring 3 1
5187 1000 Discord 3 1
77595 1000 code 3 1
4218 1000 dbus-broker-launch 3 1
4789 1000 flatpak-session-helper 3 1
5356 1000 mailspring 2 1
4207 1000 wireplumber 2 2
78791 1000 Microsoft.VisualStudio.Code.ServiceHost 2 2
5009 1000 xdg-desktop-portal 2 1
4679 1000 gsd-sound 2 1
4628 1000 ibus-daemon 2 1
4516 1000 evolution-source-registry 2 1
4558 1000 evolution-addressbook-factory 1 1
79291 1000 gnome-terminal-server 1 1
4343 1000 gvfs-udisks2-volume-monitor 1 1
4352 1000 gvfs-afc-volume-monitor 1 1
78742 1000 Microsoft.ServiceHub.Controller 1 1
78678 1000 dotnet 1 1
4360 1000 goa-daemon 1 1
4366 1000 goa-identity-service 1 1
4460 1000 dbus-broker-launch 1 1
77831 1000 code 1 1
4540 1000 evolution-calendar-factory 1 1
65603 1000 flameshot 1 1
4871 1000 flatpak-portal 1 1
5348 1000 mailspring 1 1
4631 1000 gsd-color 1 1
4637 1000 touchegg 1 1
4640 1000 gsd-housekeeping 1 1
5111 1000 ibus-x11 1 1
4743 1000 ibus-memconf 1 1
4745 1000 ibus-extension-gtk3 1 1
4752 1000 ibus-portal 1 1
4865 1000 ibus-engine-simple 1 1
------------------------------------------------------------------------------
Total inotify Watches: 524288
Total inotify Instances: 79
------------------------------------------------------------------------------
And when I query for which files the ServiceHost is listening for, I get this as an output:
./inotify-info Microsoft.VisualStudio.Code.ServiceHost
...
58872412 [259:6] /home/tcroc/dev/BlockyBall/Library/ShaderCache/vfx/wall_red478d/04/
58872413 [259:6] /home/tcroc/dev/BlockyBall/Library/ShaderCache/vfx/Smokeccec/04/
58872414 [259:6] /home/tcroc/dev/BlockyBall/Library/ShaderCache/vfx/wall_blue1dc0/04/
58873728 [259:6] /home/tcroc/dev/BlockyBall/.git/modules/Packages/com.langestudios.playfabmirror/objects/43/
58873730 [259:6] /home/tcroc/dev/BlockyBall/.git/modules/Packages/com.langestudios.playfabmirror/objects/e2/
58873732 [259:6] /home/tcroc/dev/BlockyBall/.git/modules/Packages/com.langestudios.playfabmirror/objects/72/
58873734 [259:6] /home/tcroc/dev/BlockyBall/.git/modules/Packages/com.langestudios.playfabmirror/objects/67/
58873736 [259:6] /home/tcroc/dev/BlockyBall/.git/modules/Packages/com.langestudios.playfabmirror/objects/b0/
58873738 [259:6] /home/tcroc/dev/BlockyBall/.git/lfs/objects/ff/80/
58875285 [259:6] /home/tcroc/dev/BlockyBall/Library/ShaderCache/shadergraph/DefaultVFXSG8c1e/00/
58994130 [259:6] /home/tcroc/dev/BlockyBall/Library/StateCache/PrefabStageHierarchy/ea/
...
58726855 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/NegatedUnless/
58726860 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/NegatedWhile/
58726864 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/NestedFileDirname/
58726869 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/NestedModifier/
58726883 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/NestedParenthesizedCalls/
58726891 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/NestedTernaryOperator/
58726898 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/Next/
58726926 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/NilComparison/
58726932 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/NilLambda/
58726936 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/NonNilCheck/
58726950 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/Not/
58726958 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/NumberedParameters/
58726961 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/NumberedParametersLimit/
58726966 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/NumericLiteralPrefix/
58726979 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/NumericLiterals/
58726991 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/NumericPredicate/
58727001 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/ObjectThen/
58727009 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/OneLineConditional/
58727022 [259:6] /home/tcroc/dev/BlockyBall/Pipelines/Scripts/Fastlane/Gitignore/ruby/versions/3.2.2/lib/ruby/gems/3.2.0/doc/rubocop-1.56.1/ri/RuboCop/Cop/Style/OpenStructUse/
...
So you can see the .git
folders and ruby
folders are being watched even tho my settings.json explicitly has those in "files.watcherExclude"
{
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true,
"**/.hg/store/**": true,
"**/.DS_Store":true,
"**/.git/**":true,
"**/.gitmodules":true,
"**/*.booproj":true,
"**/*.pidb":true,
"**/*.suo":true,
"**/*.user":true,
"**/*.userprefs":true,
"**/*.unityproj":true,
"**/*.dll":true,
"**/*.exe":true,
"**/*.pdf":true,
"**/*.mid":true,
"**/*.midi":true,
"**/*.wav":true,
"**/*.gif":true,
"**/*.ico":true,
"**/*.jpg":true,
"**/*.jpeg":true,
"**/*.png":true,
"**/*.psd":true,
"**/*.tga":true,
"**/*.tif":true,
"**/*.tiff":true,
"**/*.3ds":true,
"**/*.3DS":true,
"**/*.fbx":true,
"**/*.FBX":true,
"**/*.lxo":true,
"**/*.LXO":true,
"**/*.ma":true,
"**/*.MA":true,
"**/*.obj":true,
"**/*.OBJ":true,
"**/*.cubemap":true,
"**/*.flare":true,
"**/*.mat":true,
"**/*.meta":true,
"**/*.unity":true,
"**/*.prefab":true,
"**/*.asmdef":true,
"build/":true,
"Build/":true,
"Library/":true,
"library/":true,
"obj/":true,
"Obj/":true,
"temp/":true,
"Temp/":true,
"**/Gitignore/**":true,
"**/builds/**":true,
"Pipelines/Scripts/Fastlane/Gitignore/ruby": true
},
"dotnet.defaultSolution": "BlockyBall.sln",
"dotnet.preferVisualStudioCodeFileSystemWatcher": true
}
with "Pipelines/Scripts/Fastlane/Gitignore/ruby": true
and "**/.git/**":true
both being in there.
And to double check my settings:
User settings:
Workspace Settings:
Let me know if there is anything else that would be helpful for you
@TCROC thanks again for providing detailed information. This helped me to identify other areas where we may need to fallback to vscode file watcher. I'm following up with dotnet Razor team and other teams to address the issue with other processes holding high number of watches.
Could you also confirm if you restarted your vs code
instance after enabling the prefer vs code file watcher
setting?
from the Inotify-info screenshot you pasted, I was expecting a higher number of watches belonging to the code
process and a lot less coming from Microsoft.VisualStudio.Code.ServiceHost
.
can you try closing vscode and waiting until inotify-info doesn't show any of the rzls, nor VisualStudio processes, and then launching vscode again and check inotify-info once the solution is loaded
@TCROC thanks again for providing detailed information. This helped me to identify other areas where we may need to fallback to vscode file watcher. I'm following up with dotnet Razor team and other teams to address the issue with other processes holding high number of watches.
Could you also confirm if you restarted your
vs code
instance after enabling theprefer vs code file watcher
setting? from the Inotify-info screenshot you pasted, I was expecting a higher number of watches belonging to thecode
process and a lot less coming fromMicrosoft.VisualStudio.Code.ServiceHost
. can you try closing vscode and waiting until inotify-info doesn't show any of the rzls, nor VisualStudio processes, and then launching vscode again and check inotify-info once the solution is loaded
Hey @chzuluag . I can confirm that after restarting VS Code, the error still persists.
Other components that contribute to C# Dev Kit need to honour this setting too to reduce the allocation of File System Watchers on Linux. I have created internal bugs to track this work. Here is the work item tracking the work in Razor Language Server: https://github.com/dotnet/razor/issues/9370
@chzuluag thank you! Let me know if there is anything else that you need from me :)
Hello, I'm experiencing the same issue, and it causes inotify resource exhaustion on my development machine (can't run say "dotnet watch" or similar).
https://github.com/fatso83/dotfiles/blob/master/utils/scripts/inotify-consumers reports a whopping 468644 watches held by rzls
, and with strace
I can see rzls scanning everything as long as there are watches available, despite tweaking the vscode settings as described above to skip certain directories.
Although drastic, is there any flag i can use to disable rzls, since i'm not using it for the project?
Otherwise i'll need to brutally remove the rzls
binary from the vscode folder (and keep doing it on every update) until this is resolved
This issue has been marked as stale after 14 days of inactivity.@[@chzuluag@], could you please take a look?
This is definitely still an issue for me
Two pending issues to fix here: First one tracked by: https://github.com/dotnet/razor/issues/9370 Second one is file watchers created inside the .Net Project System Launch Settings. Reassigning this item to .Net project system cc: @tmeschter
BLOCKED on https://github.com/dotnet/razor/issues/9370
Describe the Issue
When opening a large project (in my specific case a Unity project) I get this error:
This tool can be used to gather information regarding which files are being listened to:
https://github.com/mikesart/inotify-info
When running
./inotify-info
, it shows the offending extensions:A few interesting things to note:
files.watcherExclude
setting in VS Code is not being respected.My
files.watcherExclude
is currently set to:When running
./inotify-info Microsoft.VisualStudio.Code.ServiceHost
we can see the specific files it is listening to which includes many that are supposed to be excluded such as:Steps To Reproduce
files.watcherExclude
to exclude some files and directories.Expected Behavior
The files and directories in
files.watcherExclude
should not be listened to.Environment Information