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

Add workaround for file watcher issue in FSAC on OS X #205

Closed
wants to merge 1 commit into from
Closed

Add workaround for file watcher issue in FSAC on OS X #205

wants to merge 1 commit into from

Conversation

kqr
Copy link

@kqr kqr commented May 17, 2019

This is the best workaround I've found so far. Without it, I cannot even load
the simplest of project files.

Fixes issue #204.

This is the best workaround I've found so far. Without it, I cannot even load
the simplest of project files.
@juergenhoetzel
Copy link
Collaborator

This is the best workaround I've found so far. Without it, I cannot even load
the simplest of project files.

Fixes issue #204.

I wonder what negative effects this change could have:

MONO_MANAGED_WATCHER=disabled"

IIRC the watcher is used by fsautocomplete.exe to track changes on project files.

It seems like a leak of file descripors. On my Arch Linux system only 9 inotify file descriptors are allocated (using your sample project):

juergen@lemmy:~/fsharp/test → lsof -n -p $(pgrep -f fsautocomplete.exe)|grep inotify
mono    869 juergen    4r  a_inode   0,13        0   11770 inotify
mono    869 juergen    5r  a_inode   0,13        0   11770 inotify
mono    869 juergen    6r  a_inode   0,13        0   11770 inotify
mono    869 juergen    7r  a_inode   0,13        0   11770 inotify
mono    869 juergen    8r  a_inode   0,13        0   11770 inotify
mono    869 juergen    9r  a_inode   0,13        0   11770 inotify
mono    869 juergen   10r  a_inode   0,13        0   11770 inotify
mono    869 juergen   11r  a_inode   0,13        0   11770 inotify
mono    869 juergen   12r  a_inode   0,13        0   11770 inotify

Can you check this out on macos using similar tools? Thanks!

@kqr
Copy link
Author

kqr commented May 21, 2019

Are you asking me to check for allocated file descriptors when I'm running with MONO_MANAGED_WATCHER=disabled or with the "managed watcher" (whatever it is)? To be clear: I cannot even start running fsautocomplete.exe with the managed watcher because it quits right away.

If I'm allowed to guess wildly, I would suspect it's using some sort of filesystem watcher API that either a) does not exist in modern OS X releases, or at least b) is protected by some sort of security measure. But I don't know enough about OS X to make a more educated guess than that – I'm forced to use the operating system at work, but I'm not interested enough in it to learn a lot about it...

@kqr
Copy link
Author

kqr commented May 21, 2019

There is also this that I found: ionide/FsAutoComplete#331 (comment)

@kqr
Copy link
Author

kqr commented May 21, 2019

Turns out if I install mono from www.mono-project.com instead of homebrew (one of the more popular package managers for OS X), FSAC loads projects just fine without workaround, and running the lsof command you suggested shows me a bunch of KQUEUE entries which I think is what corresponds to inofity in the BSD/OS X world.

So I retract this pull request, but if it's possible to detect this situation (i.e. Mono installed from homebrew and exception relating to FileWatcher when trying to load project file) and throw a more helpful error message suggesting to download and install from www.mono-project.com instead, that'd be a good idea. At least if this issue with Mono from homebrew is going to be long-lived.

@kqr kqr closed this May 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants