How to fix GitKraken Inotify Limit Error - upgrading Ubuntu/Linux inotify limits

GitKraken is a totally excellent Git client. If you’re a software developer you should absolutely give GitKraken a try. Today I went to do some commits in one of my repositories but GitKraken told me it had gotten an Inotify Limit Error, and that I needed to increase this limit. Turns out the issue has nothing to do with GitKraken, and is also fairly easy to fix.

Upon opening the repository in question, GitKraken showed a notification window with this message:

Inotify Limit Error File watching is disabled for this repository. Please increase your inotify limit and reopen this repository.

Previously in the day GitKraken gave a message while opening the same repository that it didn’t find a “Compatible Repository” and it refused to even open the repository. Thing is, the repository is fine, and I used git to do my commits without problem. It’s possible the Inotify Limit made some kind of impact on GitKraken causing GitKraken to say it could not find a compatible repository. I’ve sent the GitKraken team a query and haven’t received a reply.

An important detail is that I’m on Ubuntu 17.10. I’ve been using Mac OS X for many years, and recently setup this Ubuntu machine to see how well any kind of Linux would work for me. For what it’s worth GitKraken is working the same on both, thanks to the portability coming from it being an Electron-based application.

What is Inotify?

From Wikipedia:

Inotify (inode notify) is a Linux kernel subsystem that acts to extend filesystems to notice changes to the filesystem, and report those changes to applications.

One major use is in desktop search utilities like Beagle, where its functionality permits reindexing of changed files without scanning the filesystem for changes every few minutes, which would be very inefficient.

Since GitKraken automagically notices changes in files in a workspace, it obviously must be using this subsystem on Linux. Since I’m using Ubuntu, this applies to me.

Inotify limits
Type this command:

$ cat /proc/sys/fs/inotify/max_user_watches
8192
This is the limit on your computer.

扫描二维码关注公众号,回复: 4236511 查看本文章

Each inotify watch consumes a modest amount of memory. On a 64-bit computer like this one, each consumes 1 KB, so 8,192 watches consumes about 8 MB of memory. On a 16GB main memory computer that’s a drop in the bucket.

Temporarily increasing the limit is this simple:

# echo 99999 > /proc/sys/fs/inotify/max_user_watches

After which you’ll get this:

$ cat /proc/sys/fs/inotify/max_user_watches
99999

To make a permanent change, set fs.inotify.max_user_watches= in sysctl settings. On some systems (Debian/Ubuntu/etc) those settings are in /etc/sysctl.conf and on some others there will be a file in /etc/sysctl.d.

After editing the sysctl settings, run this:

# sysctl -p
fs.inotify.max_user_watches = 99999

Putting it on one line:

# echo fs.inotify.max_user_watches=99999 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Or on certain other systems:

发现如上方法无法直接修改文件/proc/sys/fs/inotify/max_user_watches

原文地址:
https://techsparx.com/blog/2018/02/gitkraken-inotify.html

The current inotify(7) watch limit is too low. More details.

点击这个超链接后有一篇文章讲解如何处理这个问题。原文如下所示:

link https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit

For an intelligent IDE it is essential to be in the know about any external changes in files it working with - e.g. changes made by VCS, or build tools, or code generators etc. For that reason, IntelliJ platform spins background process to monitor such changes. The method it uses is platform-specific; and on Linux it is Inotify facility.

Inotify requires a “watch handle” to be set for each directory in the project. Unfortunately, the default limit of watch handles may not be enough for reasonably sized projects, and reaching the limit will force IntelliJ platform to fall back to recursive scans of directory trees.

To prevent this situation it is recommended to increase the watches limit (to, say, 512K).

You can do it by adding following line to the /etc/sysctl.conf file:
fs.inotify.max_user_watches = 524288

Then run this command to apply the change:
sudo sysctl -p

And don’t forget to restart your IDE.

Note: the watches limit is per-account setting. If there are other programs running under the same account which also uses Inotify the limit should be raised high enough to suite needs of all of them.

主要有三个步
This method is only suitable for Mac or Linux

1.在 /etc/sysctl.conf文件中增加一行
fs.inotify.max_user_watches = 524288

2.让改变生效
sudo sysctl -p

3.重启IDE

原文地址请点击:https://blog.csdn.net/androidmalin/article/details/51271847?utm_source=copy

猜你喜欢

转载自blog.csdn.net/GorgeousChou/article/details/82934807