Sublime Forum

ST is consumming too many filewatcher

#1

My desktop (ubuntu 14.04) is often running of inotify watches.

Digging into it I found that ST is taking most of the watches (86 out of 153)

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

Note that all others program are taking only up to 1-4 watches by process (apart from my Windows manager that use 8).
Is there a good reason for ST to consume that much ?
I think there is a way to create one watch that watches several files at once, so maybe this feature is not used properly.

Do other people have the same problem ?

0 Likes

#2

I think typically the default number of inotify watchers is set around 8,192 for an Ubuntu system. 86 should be a walk in the park. inotify doesn’t allow watching a folder with all subfolders, so a watch needs to be added for each subfolder in your sidebar, plus each subfolder in your packages directory.

0 Likes

#3

Yes, GitGutter first notified me of this syndrome: https://github.com/jisaacks/GitGutter/issues/384

0 Likes

#4

That is different than an inotify watcher.

0 Likes

#5

Right… my bad!

0 Likes

#6
1 Like

#7

You can also increase the number of inotify instances allowed, as described here: https://wiki.archlinux.org/index.php/Dropbox (at the end of the troubleshooting section).
I had to do that for Dropbox, though not for st. 8k is quite low and increasing the limit doesn’t seem to have an impact on performance.

0 Likes

#8

Thanks for the details.

I think my problem with the default settings being to conservative.
There is two important settings:

sysctl -n -w fs.inotify.max_user_watches=16384
sysctl -n -w fs.inotify.max_user_instances=512

I had augmented only the max_user_watches and you also need to increase the max_user_instances settings.

0 Likes