FileSystemWatcher causes user limit exceptions on Kubuntu Linux
Using the following code results in the exception
The configured user limit (128) on the number of inotify instances has been reached, or the per-process limit on the number of open file descriptors has been reached.
:
FindItemsInProjectDirectory
does not do anything with the fs watcher object.17 Replies
I read that I could modify this limit, but that's just a workaround instead of a real solution. It also doesn't work well for portable applications.
it's either that or having a background thread that call Directory.EnumerateFiles in a loop
But doesn't it already run on a separate thread?
what gave you this impression?
The application runs without any delays or freezing, even with a large amount of files. That's flawed though now that I think about it
The issue is INcludeSubdiretories, probably.
It's been awhile since I looked, but from what I remember it opens a new inotify channel for each watched directory.
And Linux limits those.
Ah. There really aren't thatany subdirectories though, is there a way to work around this?
Nope. Gotta increase the per-user limit.
Actually, looking at your error, it's not erroring because of max watches, but because of max instances. Might be the case you're creating too many FSWs
I should only be creating one, I'll add a console.writeline in the fs watcher init function
Yeah it's only creating one instance as far as I'm aware
for context, the limit that's hit is usually the global one
not the per app one
also why do you have it at 128
the default seems to be 8192
watch != instance
That seems to be Kubuntu's default
Nvm, just read the above comment
Ah. I'm not sure what else could be causing the limit to be hit though, as there are only about 3 applications running at a time
You can probably check something in procfs to see how many are used
I could add a check before the few gets set up
or you could just go look. with your eyes
I meant as a warning for users.
Y'know, so they don't just have to deal with some random error that might look like gibberish to them
We don't want Microsoft error messages