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

Show message if insufficient file watcher handles #8458

Merged
merged 1 commit into from
Sep 8, 2020
Merged

Conversation

westbury
Copy link
Contributor

@westbury westbury commented Sep 2, 2020

What it does

Fixes #938

On Linux the limit for the number of directories that can be watched is by default 8192. Furthermore, if a watched directory has sub-directories then each sub-directory is counted in this limit. When this limit is reached, the user is not told. They simply don't see changes.

This PR shows a message to the user together with instructions on how to increase the limit.

Screenshot from 2020-09-02 09-30-59

How to test

On Linux, set the limit to 8192 (the default) and check that a message appears when the limit is reached.

Check that the message does not appear when the limit is larger, or on Windows or Mac. Test file watching and filesystem provider plugins to ensure nothing is broken.

Check that it is fine to link to vscode's page, or suggest Theia's own page.

Review checklist

Reminder for reviewers

@vince-fugnitto vince-fugnitto added file-watchers issues related to filesystem watchers - nsfw filesystem issues related to the filesystem labels Sep 2, 2020
Copy link
Member

@paul-marechal paul-marechal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was able to trigger the message using sudo sysctl -w fs.inotify.max_user_watches=16, and got no message once the value was high enough.

Although it might be unrelated to this change, but when clicking on the Instructions link it opened the same tab 4 times instantly.

});
await watcher.start();
} catch (error) {
if (error.message === 'NSFW was unable to start watching that directory.') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know how to land in this state?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the error I was getting back when I first worked on this. After rebasing etc I started getting the Inotify message in the callback. It may have been a bad build. I was never happy with this code here, and the message is too generic so may be caused by other problems, perhaps on Windows and Mac. I will spend more time seeing if I hit this code again and, if not, I'll remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've now removed this check as I cannot reproduce the condition that caused it. I also removed the link to instructions in the browser version as the user can't change the inotify limit on the server.

@westbury
Copy link
Contributor Author

westbury commented Sep 3, 2020

when clicking on the Instructions link it opened the same tab 4 times instantly

I have not seen that but, looking at the code, it is clear what the problem is. watchHandlesExhausted was set on after the await. I have now moved it before the await.

CHANGELOG.md Outdated
@@ -11,7 +11,7 @@
- This change triggers the context menu for a given shell tab-bar without the need to activate it
- While registering a command, `Event` should be passed down, if not passed, then the commands will not work correctly as they no longer rely on the activation of tab-bar
- [core] Moved `findTitle()` and `findTabBar()` from `common-frontend-contribution.ts` to `application-shell.ts` [#6965](https://github.com/eclipse-theia/theia/pull/6965)

- [core] show Linux users a warning when Inotify handles have been exhausted, with link to instructions on how to fix [#8458](https://github.com/eclipse-theia/theia/pull/8458)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[filesystem]

@westbury westbury force-pushed the watch-handles branch 2 times, most recently from f0b40ca to 7ea3cdf Compare September 8, 2020 21:15
@westbury westbury merged commit 85a002e into master Sep 8, 2020
@westbury westbury deleted the watch-handles branch September 8, 2020 22:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
file-watchers issues related to filesystem watchers - nsfw filesystem issues related to the filesystem
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nsfw watcher doesn't warn if we've reached fs.inotify.max_user_watches
4 participants