Skip to content
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

Ionide/VSCode consuming all of my inotify instances #1984

Open
JustinChristensen opened this issue Feb 10, 2024 · 8 comments
Open

Ionide/VSCode consuming all of my inotify instances #1984

JustinChristensen opened this issue Feb 10, 2024 · 8 comments

Comments

@JustinChristensen
Copy link

JustinChristensen commented Feb 10, 2024

Describe the bug

When starting watchers like dotnet watch or vite I get errors on my linux system because something is consuming all of my 128 inotify instances.

Further analysis shows that Ionide seems to be consuming most of them:

find /proc/*/fd/* -type l -lname 'anon_inode:inotify' -exec sh -c 'cat $(dirname {})/../cmdline; echo ""' \; 2>/dev/null

/usr/bin/dotnet/home/user/.vscode/extensions/ionide.ionide-fsharp-7.18.0/bin/net7.0/fsautocomplete.dll--state-directory/home/user/.config/Code/User/workspaceStorage/700616795669794e7b1ffe09d82c0eb9/Ionide.Ionide-fsharp
/usr/bin/dotnet/home/user/.vscode/extensions/ionide.ionide-fsharp-7.18.0/bin/net7.0/fsautocomplete.dll--state-directory/home/user/.config/Code/User/workspaceStorage/700616795669794e7b1ffe09d82c0eb9/Ionide.Ionide-fsharp
/usr/bin/dotnet/home/user/.vscode/extensions/ionide.ionide-fsharp-7.18.0/bin/net7.0/fsautocomplete.dll--state-directory/home/user/.config/Code/User/workspaceStorage/700616795669794e7b1ffe09d82c0eb9/Ionide.Ionide-fsharp
/usr/bin/dotnet/home/user/.vscode/extensions/ionide.ionide-fsharp-7.18.0/bin/net7.0/fsautocomplete.dll--state-directory/home/user/.config/Code/User/workspaceStorage/700616795669794e7b1ffe09d82c0eb9/Ionide.Ionide-fsharp
/usr/bin/dotnet/home/user/.vscode/extensions/ionide.ionide-fsharp-7.18.0/bin/net7.0/fsautocomplete.dll--state-directory/home/user/.config/Code/User/workspaceStorage/700616795669794e7b1ffe09d82c0eb9/Ionide.Ionide-fsharp
/usr/bin/dotnet/home/user/.vscode/extensions/ionide.ionide-fsharp-7.18.0/bin/net7.0/fsautocomplete.dll--state-directory/home/user/.config/Code/User/workspaceStorage/700616795669794e7b1ffe09d82c0eb9/Ionide.Ionide-fsharp
/usr/bin/dotnet/home/user/.vscode/extensions/ionide.ionide-fsharp-7.18.0/bin/net7.0/fsautocomplete.dll--state-directory/home/user/.config/Code/User/workspaceStorage/700616795669794e7b1ffe09d82c0eb9/Ionide.Ionide-fsharp
/usr/bin/dotnet/home/user/.vscode/extensions/ionide.ionide-fsharp-7.18.0/bin/net7.0/fsautocomplete.dll--state-directory/home/user/.config/Code/User/workspaceStorage/700616795669794e7b1ffe09d82c0eb9/Ionide.Ionide-fsharp
/usr/bin/dotnet/home/user/.vscode/extensions/ionide.ionide-fsharp-7.18.0/bin/net7.0/fsautocomplete.dll--state-directory/home/user/.config/Code/User/workspaceStorage/700616795669794e7b1ffe09d82c0eb9/Ionide.Ionide-fsharp
/usr/bin/dotnet/home/user/.vscode/extensions/ionide.ionide-fsharp-7.18.0/bin/net7.0/fsautocomplete.dll--state-directory/home/user/.config/Code/User/workspaceStorage/700616795669794e7b1ffe09d82c0eb9/Ionide.Ionide-fsharp
/usr/bin/dotnet/home/user/.vscode/extensions/ionide.ionide-fsharp-7.18.0/bin/net7.0/fsautocomplete.dll--state-directory/home/user/.config/Code/User/workspaceStorage/700616795669794e7b1ffe09d82c0eb9/Ionide.Ionide-fsharp
/usr/bin/dotnet/home/user/.vscode/extensions/ionide.ionide-fsharp-7.18.0/bin/net7.0/fsautocomplete.dll--state-directory/home/user/.config/Code/User/workspaceStorage/700616795669794e7b1ffe09d82c0eb9/Ionide.Ionide-fsharp
...

Machine info

  • OS: Fedora 39
  • .NET SDK version: 8.0.0
  • Ionide version: 7.18.0

Additional context

I've had this instance of vscode open for a while. I'm not sure what triggers this situation to happen, but something appears to be spinning up lots and lots of instances of this fsautocomplete.dll thing and is consuming all of my inotify instances.

@MangelMaxime
Copy link
Contributor

Hello 128 inotify instance doesn't seems like a loot.

If possible you can increase that limit: https://dev.to/rubiin/ubuntu-increase-inotify-watcher-file-watch-limit-kf4

I am not sure if this will helps, but in general on Unix system I set .NET to use Polling for watching files. You can do that by this setting export DOTNET_USE_POLLING_FILE_WATCHER=true in your .bashrc or .zshrc file.

@JustinChristensen
Copy link
Author

JustinChristensen commented Feb 10, 2024

I understand your perspective here, and I'm aware I'd be able to adjust that limit or force it to use a different polling mechanism, but this is the first time I've ever been confronted with this as a problem, and Ionide isn't the only program I run that relies on inotify.

From my perspective this is a clear bug somewhere (whether its a bug in vscode itself or Ionide I can't say), and it shouldn't be consuming 120-some inotify instances just to work on one project in one instance of vscode.

128 instances is the default setting, and for most people running watchers they'll never even come close to that limit if the programs they're running make correct use of this resource.

@JustinChristensen
Copy link
Author

Also 128 is just the upper bound it ran into where it couldn't spawn any more inotify instances. If something is going haywire and continuing to try and create them even setting it to 600 wouldn't solve the problem - it would just cause Ionide to eventually be consuming 600 inotify instances.

@MangelMaxime
Copy link
Contributor

I don't know from my experience VSCode/Ionide is not the only program that has this issues on my machines that's why I proposed to increase the limit.

For now this is a workaround until someone has an idea how to debug this issue or fix it.

@TheAngryByrd
Copy link
Member

Since we use FileSystemWatcher for changes to fsproj and related files it's a dotnet runtime issue. dotnet/runtime#62869

@JustinChristensen
Copy link
Author

Yeah, but if I understand the API correctly that implies one FileSystemWatcher is one inotify instance? If so, shouldn't Ionide only ever be creating one FileSystemWatcher at a time? Meaning, is something not disposing of FileSystemWatcher's when it should be?

@TheAngryByrd
Copy link
Member

If so, shouldn't Ionide only ever be creating one FileSystemWatcher at a time?

No, we create FileSystemWatcher to watch F# Projects and related files to know when to schedule msbuild project reloading. This could be many depending on your projects.

@JustinChristensen
Copy link
Author

Well, in this case I only had one vscode instance open with a slightly modified solution based on https://github.com/elmish/templates/tree/master. Not a large project. I'm testing out Fable for the first time, and then boom I find that Ionide has hogging all of my system's inotify instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants