[Linux] System.InvalidOperationException: object_op ---> System.IO.IOException: The configured user limit (128) on the number of inotify instances has been
See original GitHub issueIssue Description
I’m gettings this error on a Linux Mint 19.2 machine. cat /proc/sys/fs/inotify/max_user_watches
outputs 524288
.
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
OmniSharp server started with Mono 6.0.0. Path: /home/vladius/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/OmniSharp.exe PID: 13308
Starting OmniSharp on linuxmint 19.2 (x64)
DotNetPath set to dotnet
Located 2 MSBuild instance(s)
1: Mono 16.0 - "/usr/lib/mono/msbuild/Current/bin"
2: StandAlone 16.0 - "/home/vladius/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/.msbuild/Current/Bin"
Registered MSBuild instance: Mono 16.0 - "/usr/lib/mono/msbuild/Current/bin"
CscToolExe = csc.exe
CscToolPath = /home/vladius/.vscode/extensions/ms-vscode.csharp-1.21.3/.omnisharp/1.34.3/omnisharp/.msbuild/Current/Bin/Roslyn
Exception thrown while calling event sinks
System.InvalidOperationException: object_op —> System.IO.IOException: The configured user limit (128) on the number of inotify instances has been reached.
at System.IO.CoreFX.FileSystemWatcher.StartRaisingEvents () [0x0007b] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFX.FileSystemWatcher.StartRaisingEventsIfNotDisposed () [0x00019] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFX.FileSystemWatcher.set_EnableRaisingEvents (System.Boolean value) [0x0001d] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at (wrapper remoting-invoke-with-check) System.IO.CoreFX.FileSystemWatcher.set_EnableRaisingEvents(bool)
at System.IO.CoreFXFileSystemWatcherProxy+<>c.<StartDispatching>b__9_0 (System.IO.CoreFX.FileSystemWatcher internal_fsw, System.IO.FileSystemWatcher fsw) [0x00048] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFXFileSystemWatcherProxy.Operation (System.Action4[T1,T2,T3,T4] map_op, System.Action
2[T1,T2] object_op, System.Object handle, System.Action2[T1,T2] cancel_op) [0x00184] in <f62d843bc8f04cc48580b577d5f0a74e>:0 --- End of inner exception stack trace --- at System.IO.CoreFXFileSystemWatcherProxy.Operation (System.Action
4[T1,T2,T3,T4] map_op, System.Action2[T1,T2] object_op, System.Object handle, System.Action
2[T1,T2] cancel_op) [0x001a6] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFXFileSystemWatcherProxy.StartDispatching (System.Object handle) [0x00004] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.FileSystemWatcher.Start () [0x0001b] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.FileSystemWatcher.set_EnableRaisingEvents (System.Boolean value) [0x0003d] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at (wrapper remoting-invoke-with-check) System.IO.FileSystemWatcher.set_EnableRaisingEvents(bool)
at Microsoft.AspNetCore.Razor.OmniSharpPlugin.MSBuildProjectDocumentChangeDetector.ProjectLoaded (OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs loadedArgs) [0x00266] in <8c6f4eb2e16d4051ba80a599aba81c54>:0
at OmniSharp.MSBuild.ProjectManager.ProcessQueue (System.Threading.CancellationToken cancellationToken) [0x00198] in <66e377b85a4d44b3a9b82d0e2eafa257>:0
info: OmniSharp.MSBuild.ProjectManager
Update project: Turbanov.Toolworks.Schweizer.Runtime.Tests
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly ‘/home/vladius/Projects/magic-coins/MagicCoins.Unity/Temp/bin/Debug/Turbanov.Toolworks.Schweizer.Runtime.dll’
fail: OmniSharp.MSBuild.ProjectManager
Exception thrown while calling event sinks
System.InvalidOperationException: object_op —> System.IO.IOException: The configured user limit (128) on the number of inotify instances has been reached.
at System.IO.CoreFX.FileSystemWatcher.StartRaisingEvents () [0x0007b] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFX.FileSystemWatcher.StartRaisingEventsIfNotDisposed () [0x00019] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFX.FileSystemWatcher.set_EnableRaisingEvents (System.Boolean value) [0x0001d] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at (wrapper remoting-invoke-with-check) System.IO.CoreFX.FileSystemWatcher.set_EnableRaisingEvents(bool)
at System.IO.CoreFXFileSystemWatcherProxy+<>c.<StartDispatching>b__9_0 (System.IO.CoreFX.FileSystemWatcher internal_fsw, System.IO.FileSystemWatcher fsw) [0x00048] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFXFileSystemWatcherProxy.Operation (System.Action4[T1,T2,T3,T4] map_op, System.Action
2[T1,T2] object_op, System.Object handle, System.Action2[T1,T2] cancel_op) [0x00184] in <f62d843bc8f04cc48580b577d5f0a74e>:0 --- End of inner exception stack trace --- at System.IO.CoreFXFileSystemWatcherProxy.Operation (System.Action
4[T1,T2,T3,T4] map_op, System.Action2[T1,T2] object_op, System.Object handle, System.Action
2[T1,T2] cancel_op) [0x001a6] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFXFileSystemWatcherProxy.StartDispatching (System.Object handle) [0x00004] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.FileSystemWatcher.Start () [0x0001b] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.FileSystemWatcher.set_EnableRaisingEvents (System.Boolean value) [0x0003d] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at (wrapper remoting-invoke-with-check) System.IO.FileSystemWatcher.set_EnableRaisingEvents(bool)
at Microsoft.AspNetCore.Razor.OmniSharpPlugin.MSBuildProjectDocumentChangeDetector.ProjectLoaded (OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs loadedArgs) [0x00266] in <8c6f4eb2e16d4051ba80a599aba81c54>:0
at OmniSharp.MSBuild.ProjectManager.ProcessQueue (System.Threading.CancellationToken cancellationToken) [0x00198] in <66e377b85a4d44b3a9b82d0e2eafa257>:0
info: OmniSharp.MSBuild.ProjectManager
Update project: Turbanov.Toolworks.Schweizer.Runtime
fail: OmniSharp.MSBuild.ProjectManager
Exception thrown while calling event sinks
System.InvalidOperationException: object_op —> System.IO.IOException: The configured user limit (128) on the number of inotify instances has been reached.
at System.IO.CoreFX.FileSystemWatcher.StartRaisingEvents () [0x0007b] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFX.FileSystemWatcher.StartRaisingEventsIfNotDisposed () [0x00019] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFX.FileSystemWatcher.set_EnableRaisingEvents (System.Boolean value) [0x0001d] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at (wrapper remoting-invoke-with-check) System.IO.CoreFX.FileSystemWatcher.set_EnableRaisingEvents(bool)
at System.IO.CoreFXFileSystemWatcherProxy+<>c.<StartDispatching>b__9_0 (System.IO.CoreFX.FileSystemWatcher internal_fsw, System.IO.FileSystemWatcher fsw) [0x00048] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFXFileSystemWatcherProxy.Operation (System.Action4[T1,T2,T3,T4] map_op, System.Action
2[T1,T2] object_op, System.Object handle, System.Action2[T1,T2] cancel_op) [0x00184] in <f62d843bc8f04cc48580b577d5f0a74e>:0 --- End of inner exception stack trace --- at System.IO.CoreFXFileSystemWatcherProxy.Operation (System.Action
4[T1,T2,T3,T4] map_op, System.Action2[T1,T2] object_op, System.Object handle, System.Action
2[T1,T2] cancel_op) [0x001a6] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFXFileSystemWatcherProxy.StartDispatching (System.Object handle) [0x00004] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.FileSystemWatcher.Start () [0x0001b] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.FileSystemWatcher.set_EnableRaisingEvents (System.Boolean value) [0x0003d] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at (wrapper remoting-invoke-with-check) System.IO.FileSystemWatcher.set_EnableRaisingEvents(bool)
at Microsoft.AspNetCore.Razor.OmniSharpPlugin.MSBuildProjectDocumentChangeDetector.ProjectLoaded (OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs loadedArgs) [0x00266] in <8c6f4eb2e16d4051ba80a599aba81c54>:0
at OmniSharp.MSBuild.ProjectManager.ProcessQueue (System.Threading.CancellationToken cancellationToken) [0x00198] in <66e377b85a4d44b3a9b82d0e2eafa257>:0
info: OmniSharp.MSBuild.ProjectManager
Update project: Turbanov.Toolworks.UIniverse.Editor
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly ‘/home/vladius/Projects/magic-coins/MagicCoins.Unity/Temp/bin/Debug/Turbanov.Toolworks.Schweizer.Editor.dll’
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly ‘/home/vladius/Projects/magic-coins/MagicCoins.Unity/Temp/bin/Debug/Turbanov.Toolworks.Schweizer.Runtime.dll’
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly ‘/home/vladius/Projects/magic-coins/MagicCoins.Unity/Temp/bin/Debug/Turbanov.Toolworks.UIniverse.dll’
fail: OmniSharp.MSBuild.ProjectManager
Exception thrown while calling event sinks
System.InvalidOperationException: object_op —> System.IO.IOException: The configured user limit (128) on the number of inotify instances has been reached.
at System.IO.CoreFX.FileSystemWatcher.StartRaisingEvents () [0x0007b] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFX.FileSystemWatcher.StartRaisingEventsIfNotDisposed () [0x00019] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFX.FileSystemWatcher.set_EnableRaisingEvents (System.Boolean value) [0x0001d] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at (wrapper remoting-invoke-with-check) System.IO.CoreFX.FileSystemWatcher.set_EnableRaisingEvents(bool)
at System.IO.CoreFXFileSystemWatcherProxy+<>c.<StartDispatching>b__9_0 (System.IO.CoreFX.FileSystemWatcher internal_fsw, System.IO.FileSystemWatcher fsw) [0x00048] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFXFileSystemWatcherProxy.Operation (System.Action4[T1,T2,T3,T4] map_op, System.Action
2[T1,T2] object_op, System.Object handle, System.Action2[T1,T2] cancel_op) [0x00184] in <f62d843bc8f04cc48580b577d5f0a74e>:0 --- End of inner exception stack trace --- at System.IO.CoreFXFileSystemWatcherProxy.Operation (System.Action
4[T1,T2,T3,T4] map_op, System.Action2[T1,T2] object_op, System.Object handle, System.Action
2[T1,T2] cancel_op) [0x001a6] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.CoreFXFileSystemWatcherProxy.StartDispatching (System.Object handle) [0x00004] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.FileSystemWatcher.Start () [0x0001b] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at System.IO.FileSystemWatcher.set_EnableRaisingEvents (System.Boolean value) [0x0003d] in <f62d843bc8f04cc48580b577d5f0a74e>:0
at (wrapper remoting-invoke-with-check) System.IO.FileSystemWatcher.set_EnableRaisingEvents(bool)
at Microsoft.AspNetCore.Razor.OmniSharpPlugin.MSBuildProjectDocumentChangeDetector.ProjectLoaded (OmniSharp.MSBuild.Notification.ProjectLoadedEventArgs loadedArgs) [0x00266] in <8c6f4eb2e16d4051ba80a599aba81c54>:0
at OmniSharp.MSBuild.ProjectManager.ProcessQueue (System.Threading.CancellationToken cancellationToken) [0x00198] in <66e377b85a4d44b3a9b82d0e2eafa257>:0
info: OmniSharp.MSBuild.ProjectManager
Update project: Turbanov.Toolworks.UIniverse
[warn]: OmniSharp.MSBuild.ProjectManager
Unable to resolve assembly ‘/home/vladius/Projects/magic-coins/MagicCoins.Unity/Temp/bin/Debug/Turbanov.Toolworks.Schweizer.Runtime.dll’
fail: OmniSharp.MSBuild.ProjectManager
Exception thrown while calling event sinks
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: c7f2f96116Runtime 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-download
Visual 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 |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:12
- Comments:5
Top GitHub Comments
This isn’t about the number of user watches : it’s about the number of inotify instances.
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.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.