SUMMARY Kate spawns many inotify instances. STEPS TO REPRODUCE 1. Start Kate 2. Open some project OBSERVED RESULT Kate spawns 10-15 inotify instances EXPECTED RESULT Kate should limit the inotify instances as the default number of allowed inotify instances per user is 127. Using multiple kate instances can easily use up all the available instances causing numerous problems in other applications. SOFTWARE/OS VERSIONS Kate: 22.11.70 Linux/KDE Plasma: Ubuntu 22.04.1 LTS (available in About System) KDE Plasma Version: 5.24.6 KDE Frameworks Version: 5.100.0 Qt Version: 5.13.3 ADDITIONAL INFORMATION I used the following script to investigate the issue: https://github.com/fatso83/dotfiles/blob/master/utils/scripts/inotify-consumers Below there is an example of the output. As you can see PyCharm uses 3217 watches, but only a singe instance. This is not a problem, since the max_user_watches limit is quite large (65535). On the other hand Kate uses 10+ watch instance for the 30+ files. This is a problem, because the max_user_instances limit is only 128 by default. Running 3 kate instance uses up 30% of the available watch instances. INOTIFY INSTANCES WATCHES PER COUNT PROCESS PID USER COMMAND ------------------------------------------------------------ 3217 1 19116 pozsgai /snap/pycharm-professional/306/bin/fsnotifier 92 4 3188 pozsgai /lib/systemd/systemd --user 78 1 3707 pozsgai /usr/libexec/xdg-desktop-portal-gtk 77 1 3646 pozsgai /usr/libexec/xdg-desktop-portal-gnome 54 4 3731 pozsgai /usr/bin/kded5 37 12 80717 pozsgai /home/pozsgai/projects/kde/build/kde/applications/kate/bin/kate 36 1 3227 pozsgai /usr/libexec/tracker-miner-fs-3 30 13 19236 pozsgai /home/pozsgai/projects/kde/build/kde/applications/kate/bin/kate 29 14 28352 pozsgai /home/pozsgai/projects/kde/build/kde/applications/kate/bin/kate 28 8 5511 pozsgai /opt/google/chrome/chrome --enable-crashpad
I guess we should try to share our QFileSystemWatcher instances. I think the issue is we create one or two per project if I don't read the code wrongly.
https://invent.kde.org/utilities/kate/-/merge_requests/1017
https://invent.kde.org/utilities/kate/-/merge_requests/1019
These two requests shall limit the number of watchers we use a lot.
I think it should work now as intended.