Closed vladipus closed 2 weeks ago
I'm using ubuntu 20.04
I also have a huge number of inotify
watches available, yet omnisharp keeps failing when reaching 128.
In my case if I have multiple projects open in different vscode windows, this problem occurs. I need to close some windows to be able to continue working. Related to #3058. This is very frustrating.
Are there workarounds for now?
I recently discovered that when restarting vscode (usualy after a debugger crash) the plugin also crashes and remains in memory. This can be verified using ps aux | grep dotnettools
, and/or a tool that counts inotify watches.
So we need to kill those processes to release the watches. Then vscode can be started normally.
This isn't about the number of user watches : it's about the number of inotify instances.
❯ inotify-consumers
INOTIFY INSTANCES
WATCHES PER
COUNT PROCESS PID USER COMMAND
------------------------------------------------------------
1751 45 162774 awilkins /home/awilkins/.vscode/extensions/ms-dotnettools.csharp-1.24.4-linux-x64/.omnisharp/1.38.2/bin/mono /home/awilkins/.vscode/extensions/ms-dotnettool
2387 5 162718 awilkins /home/awilkins/.vscode/extensions/ms-dotnettools.csharp-1.24.4-linux-x64/.razor/rzls -lsp --trace 0
1748 1 4011 awilkins /usr/bin/syncthing -no-browser
1413 1 3153 awilkins /usr/libexec/tracker-miner-fs
542 2 162284 awilkins /usr/share/code/code --ms-enable-electron-run-as-node /usr/share/code/resources/app/out/bootstrap-fork --type=fileWatcher
113 6 3145 awilkins /lib/systemd/systemd --user
91 1 3588 awilkins /usr/lib/unity-settings-daemon/unity-settings-daemon
84 1 3409 awilkins /usr/libexec/xdg-desktop-portal-gtk
25 1 4135 awilkins /usr/libexec/gvfsd-trash --spawner :1.4 /org/gtk/gvfs/exec_spaw/0
25 1 3932 awilkins /snap/snap-store/558/usr/bin/snap-store --gapplication-service
13 1 10761 awilkins update-notifier
11 1 4287 awilkins nemo-desktop
9 1 9874 awilkins zeitgeist-datahub
8 2 3854 awilkins /usr/bin/compiz
8 1 12153 awilkins /usr/lib/thunderbird/thunderbird
8 1 10023 awilkins /usr/lib/firefox/firefox
7 1 9893 awilkins /usr/lib/zeitgeist/zeitgeist-fts
6 3 162082 awilkins /usr/share/code/code --enable-crashpad gpconnect-user-portal
6 1 14221 awilkins /usr/bin/unity-scope-loader applications/applications.scope applications/scopes.scope commands.scope
5 1 3584 awilkins /usr/lib/x86_64-linux-gnu/indicator-sound/indicator-sound-service
5 1 3579 awilkins /usr/lib/x86_64-linux-gnu/indicator-messages/indicator-messages-service
5 1 3577 awilkins /usr/lib/x86_64-linux-gnu/indicator-datetime/indicator-datetime-service
4 2 48517 awilkins /usr/share/discord/Discord
4 2 27218 awilkins /usr/share/teams/teams --disable-namespace-sandbox --disable-setuid-sandbox
4 2 17855 awilkins /usr/lib/slack/slack --enable-crashpad
4 1 3574 awilkins /usr/lib/x86_64-linux-gnu/bamf/bamfdaemon
4 1 3164 awilkins /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
3 1 162937 awilkins /usr/lib/jvm/java-11-amazon-corretto/bin/java -jar /home/awilkins/.vscode/extensions/sonarsource.sonarlint-vscode-3.4.1/server/sonarlint-ls.jar 394
3 1 162806 awilkins /home/awilkins/.vscode/extensions/ms-vsliveshare.vsliveshare-1.0.5561/dotnet_modules/vsls-agent --autoexit --enableRpcInitialize --pipe vscode.7b81
3 1 162805 awilkins /bin/sh -c "/home/awilkins/.vscode/extensions/ms-vsliveshare.vsliveshare-1.0.5561/dotnet_modules/vsls-agent" --autoexit --enableRpcInitialize --pip
3 1 162768 awilkins bash /home/awilkins/.vscode/extensions/ms-dotnettools.csharp-1.24.4-linux-x64/.omnisharp/1.38.2/run -z -s /home/awilkins/gpconnect/gpconnect-user-p
3 1 162737 awilkins /usr/share/code/code --ms-enable-electron-run-as-node /home/awilkins/.vscode/extensions/redhat.fabric8-analytics-0.3.5/dist/server.js --node-ipc --
3 1 162649 awilkins /usr/share/code/code --ms-enable-electron-run-as-node /home/awilkins/.vscode/extensions/ms-azuretools.vscode-docker-1.22.0/dist/compose-language-se
3 1 162644 awilkins /usr/share/code/code --ms-enable-electron-run-as-node /home/awilkins/.vscode/extensions/ms-azuretools.vscode-docker-1.22.0/dist/dockerfile-language
3 1 162631 awilkins /usr/share/code/code --ms-enable-electron-run-as-node /home/awilkins/.vscode/extensions/redhat.vscode-yaml-1.7.0/dist/languageserver.js --node-ipc
3 1 162611 awilkins /usr/share/code/code --ms-enable-electron-run-as-node /home/awilkins/.vscode/extensions/mtxr.sqltools-0.23.0/dist/languageserver.js --node-ipc --cl
3 1 162603 awilkins /home/awilkins/nvim/bin/nvim -N --embed -c source /home/awilkins/.vscode/extensions/asvetliakov.vscode-neovim-0.0.84/vim/vscode-options.vim --cmd s
3 1 162216 awilkins /usr/share/code/code --ms-enable-electron-run-as-node --inspect-port=0 /usr/share/code/resources/app/out/bootstrap-fork --type=extensionHost --skip
3 1 14272 awilkins /usr/share/spotify/spotify
2 2 3605 awilkins /usr/libexec/gnome-session-binary --systemd --builtin --session=unity
2 2 3151 awilkins /usr/bin/pulseaudio --daemonize=no --log-target=journal
2 2 27464 awilkins /usr/share/teams/teams --type=renderer --autoplay-policy=no-user-gesture-required --disable-background-timer-throttling --field-trial-handle=138244
2 1 48561 awilkins /usr/share/discord/Discord --type=utility --utility-sub-type=network.mojom.NetworkService --field-trial-handle=11819744161397342864,535497400513036
2 1 3658 awilkins /usr/libexec/evolution-source-registry
2 1 3325 awilkins /usr/bin/ibus-daemon --daemonize --xim
2 1 27262 awilkins /usr/share/teams/teams --type=utility --utility-sub-type=network.mojom.NetworkService --field-trial-handle=13824464907744343692,3232629623915110335
2 1 17897 awilkins /usr/lib/slack/slack --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-GB --service-sandbox-type=none --enable-logging --ena
2 1 162151 awilkins /usr/share/code/code --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-GB --service-sandbox-type=none --enable-crashpad --cr
2 1 14305 awilkins /usr/share/spotify/spotify --type=utility --utility-sub-type=network.mojom.NetworkService --lang=en-US --service-sandbox-type=none --no-sandbox --l
1 1 3896 awilkins /usr/bin/moolticute --autolaunched
1 1 3677 awilkins /usr/libexec/evolution-addressbook-factory
1 1 3668 awilkins /usr/libexec/evolution-calendar-factory
1 1 3377 awilkins /usr/libexec/ibus-engine-simple
1 1 3361 awilkins /usr/bin/dbus-daemon --config-file=/usr/share/defaults/at-spi2/accessibility.conf --nofork --print-address 3
1 1 3346 awilkins /usr/libexec/ibus-portal
1 1 3343 awilkins /usr/libexec/ibus-x11 --kill-daemon
1 1 3341 awilkins /usr/libexec/ibus-extension-gtk3
1 1 3338 awilkins /usr/libexec/ibus-ui-gtk3
1 1 3335 awilkins /usr/libexec/ibus-memconf
1 1 3317 awilkins /usr/libexec/gvfs-afc-volume-monitor
1 1 3312 awilkins /usr/libexec/goa-identity-service
1 1 3266 awilkins /usr/libexec/goa-daemon
1 1 3213 awilkins /usr/libexec/gvfs-udisks2-volume-monitor
1 1 16271 awilkins /usr/libexec/gnome-terminal-server
1 1 162235 awilkins /usr/share/code/code --type=renderer --enable-crashpad --crashpad-handler-pid=162130 --enable-crash-reporter=3a871671-b332-4d29-80d8-8265188eb7ef,n
1 1 15922 awilkins /usr/bin/python3 /usr/bin/pasaffe
1 1 151411 awilkins /usr/bin/python3 /usr/bin/update-manager --no-update --no-focus-on-map
1 1 14219 awilkins /usr/lib/x86_64-linux-gnu/unity-lens-files/unity-files-daemon
8365 WATCHES TOTAL COUNT
INotify instances per user (e.g. limits specified by fs.inotify.max_user_instances):
INSTANCES USER
----------- ------------------
131 awilkins
❯ cat /proc/sys/fs/inotify/max_user_instances
128
Most processes that use inotify use one instance. Even systemd
only consumes 6 inotify instances.
Omnisharp is consuming 45 (and rzls is consuming another 5 - is this to do with how .NET handles file watching?).
The quick kludge is to bump max_user_instances
to a higher number, but this level of consumption still looks excessive.
Tomayto tomahto, you know what I mean :). inotify watches or instances, I'm talking about the same thing. And I use the same script as you, except in my case it's consuming 10s of thousands per omnisharp instance. Consider yourself lucky. I have to kill all those processes multiple times per day.
Agree with you that it's incredibly strange that omnisharp needs so many inotify instances. The next biggest consumer for me is webpack and node, which are notoriously bad at this, and only take a few hundred between them (sarcasm). Something's really wrong.
This MAJOR problem has been in existence for years. It's something I struggle with multiple times every day.
Related:
Possible diagnoses:
The vscode team has had trouble reproducing this issue; I hope aggregating these will help them repro and find the root cause.
This should no longer be an issue in the Roslyn LSP version of the C# extension if you want to update to that.
Issue Description
I'm gettings this error on a Linux Mint 19.2 machine.
cat /proc/sys/fs/inotify/max_user_watches
outputs524288
.Steps to Reproduce
Opened a large Unity project on Linux.
Expected Behavior
No errors to be thrown.
Actual Behavior
An exception is thrown.
Logs
OmniSharp log
C# log
Environment information
VSCode version: 1.38.1 C# Extension: 1.21.3
Mono Information
OmniSharp using global mono :6.0.0Dotnet Information
.NET Core SDK (reflecting any global.json): Version: 2.2.402 Commit: c7f2f96116 Runtime Environment: OS Name: linuxmint OS Version: 19.2 OS Platform: Linux RID: linuxmint.19.2-x64 Base Path: /usr/share/dotnet/sdk/2.2.402/ Host (useful for support): Version: 2.2.7 Commit: b1e29ae826 .NET Core SDKs installed: 2.2.402 [/usr/share/dotnet/sdk] .NET Core runtimes installed: Microsoft.AspNetCore.All 2.2.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.2.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.2.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App] To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-downloadVisual Studio Code Extensions
|Extension|Author|Version| |---|---|---| |code-settings-sync|Shan|3.4.2| |code-spell-checker|streetsidesoftware|1.7.18| |code-spell-checker-russian|streetsidesoftware|0.2.2| |csharp|ms-vscode|1.21.3| |csharpextensions|jchannon|1.3.0| |docomment|k--kato|0.1.8| |doxdocgen|cschlosser|0.5.0| |Doxygen|bbenoist|1.0.0| |gc-excelviewer|GrapeCity|2.1.32| |git-easy|bibhasdn|1.11.0| |git-project-manager|felipecaputo|1.7.1| |gitblame|waderyan|3.0.1| |gitconfig|sidneys1|2.0.1| |githd|huizhou|2.1.0| |githistory|donjayamanne|0.4.6| |gitlens|eamodio|9.9.3| |html-css-class-completion|Zignd|1.19.0| |JavaScriptSnippets|xabikos|1.7.2| |jinja|wholroyd|0.0.8| |MagicPython|magicstack|1.1.0| |node-module-intellisense|leizongmin|1.5.0| |nodejs-extension-pack|waderyan|0.1.9| |npm-intellisense|christian-kohler|1.3.0| |path-intellisense|christian-kohler|1.4.2| |prettier-vscode|esbenp|2.2.2| |psi-header|psioniq|1.8.0| |python|ms-python|2019.9.34911| |search-node-modules|jasonnutter|1.3.0| |unity-code-snippets|kleber-swf|1.3.0| |unity-debug|Unity|2.7.2| |vscode-csharp-snippets|jorgeserrano|0.3.1| |vscode-eslint|dbaeumer|1.9.1| |vscode-languagetool|adamvoss|3.8.0| |vscode-npm-script|eg2|0.3.9|;