After starting Elisa, I get the following message many thousands of times: inotify_add_watch(/home/cory/Music/[Artist]/[Album]/[Track].mp3) failed: (No space left on device) My music collection is ~14,000 songs. I'm concerned that the scanning approach adopted by Elisa may not be scaling well. For example, the "Scanning" message remains on my Elisa window for several minutes, my system works fairly hard after starting Elisa, and when running Elisa both it and baloo_file consume ~258GiB of virtual RAM (the resident set is much smaller, but the behavior is still unusual). If my scaling concerns are unfounded, please just consider this a report of inotify_add_watch() behavior. STEPS TO REPRODUCE: Start Elisa with a music collection of ~14,000 songs. OBSERVED RESULT: The issues listed above. EXPECTED RESULT: A quicker/leaner startup and execution without errors. SOFTWARE/OS VERSIONS: Kubuntu 19.04, Elisa version 0.4.80 (built from source)
(In reply to Cory F Cohen from comment #0) > After starting Elisa, I get the following message many thousands of times: > > inotify_add_watch(/home/cory/Music/[Artist]/[Album]/[Track].mp3) failed: (No > space left on device) > > My music collection is ~14,000 songs. I'm concerned that the scanning > approach adopted by Elisa may not be scaling well. For example, the > "Scanning" message remains on my Elisa window for several minutes, my system > works fairly hard after starting Elisa, and when running Elisa both it and > baloo_file consume ~258GiB of virtual RAM (the resident set is much smaller, > but the behavior is still unusual). > > If my scaling concerns are unfounded, please just consider this a report of > inotify_add_watch() behavior. > > STEPS TO REPRODUCE: Start Elisa with a music collection of ~14,000 songs. > OBSERVED RESULT: The issues listed above. > EXPECTED RESULT: A quicker/leaner startup and execution without errors. > SOFTWARE/OS VERSIONS: Kubuntu 19.04, Elisa version 0.4.80 (built from source) I wanted for a very long time to avoid allowing the user to deactivate checking deleted files at start. In the end, I will include that alongside the Elisa KCM redesign. That should allow you to choose between very few activity at start and quite some. Using Baloo is helping also reduce this and it should also be possible to improve this use case specifically (I have to check). The virtual size of baloo and elisa comes from the way the baloo database works and is really nothing to care about.
Thank you for considering this bug report. I wanted to add one additional detail that I recently discovered. Apparently by having used all of the inotify_add_watch handles available on the system, other applications such as Dolphin that need handles for other watch tasks are unable to obtain them. A a result, when Elisa is running no other inotify_add_watch calls can succeed and newly created files do not appear in open Dolphin windows. This probably doesn't change your redesign plans, but hopefully it provides more evidence for a why a different approach is needed.
I'm not sure from the existing comments whether more info is needed, but I can add that I encounter this bug as well. I have a music collection of 1.4 TB on a NAS which is mounted to `~/Music` by `/etc/fstab`. Baloo has successfully indexed everything and in my case, I can easily start elisa without issues. The only time I encounter the bogus 'No space left on device' errors is when going to elisa and clicking 'Refresh Music Collection', as that seems to get elisa to start indexing everything from scratch all over, and after the first few minutes of scanning, the "no space" errors start cropping up.
Git commit 662f88b78a7ee3bef27e584b00ad3ca3c300cf62 by Matthieu Gallien. Committed on 06/01/2021 at 17:00. Pushed by mgallien into branch 'release/20.12'. use a QFlags to handle entities to watch for file system changes use separate enum values for watching changes to directories or files by default do like before M +22 -14 src/abstractfile/abstractfilelisting.cpp M +12 -4 src/abstractfile/abstractfilelisting.h M +6 -6 src/baloo/localbaloofilelisting.cpp M +1 -1 src/baloo/localbaloofilelisting.h M +2 -3 src/file/localfilelisting.cpp M +1 -1 src/file/localfilelisting.h https://invent.kde.org/multimedia/elisa/commit/662f88b78a7ee3bef27e584b00ad3ca3c300cf62
Git commit 940c56853d3b4d26ece28f0ac4f1c29faf814dd8 by Matthieu Gallien. Committed on 16/02/2021 at 07:18. Pushed by mgallien into branch 'master'. when using Baloo does not watch for changes itself rely mostly on Baloo for changes notifications (not complete) M +4 -4 src/baloo/localbaloofilelisting.cpp https://invent.kde.org/multimedia/elisa/commit/940c56853d3b4d26ece28f0ac4f1c29faf814dd8
As of Elisa 22.12.3, the problem with Elisa interfering with Dolphin's ability to watch for new files appears to have been resolved. Also, the many inotify_add_watch() errors are gone. I presume that you knew this, but figured that I should report back since the ticket is still open. I presume you're keeping the ticket open as a reminder to further revisit how to improve watching for new files.
I can confirm this issue. I happens every time when elisa is run. ``` Inotify Watch Capacity Low Your open applications want to watch too many files for changes! When the capacity is exhausted it will prevent further file monitoring from working correctly. Either close some applications or increase the limit. Currently using 25% of instances and 98% of watches. <button>Increase Watch Limit</button> ``` Increasing the limit via the dialog (see attachments) helps to solve the problem. With `inotify-consumers` it is possible to list the applications that use inotify. Elisa uses over 100k monitors and the number keeps increasing. ``` $ bash /tmp/inotify-consumers INOTIFY INSTANCES WATCHES PER COUNT PROCESS PID USER COMMAND ------------------------------------------------------------ 115295 5 2102749 nlnet /nix/store/3wvgmnm5rkqii79arggmvnda25ahqwcq-elisa-23.04.1/bin/elisa 202 1 1954876 nlnet /run/current-system/sw/bin/kded5 126 2 1954922 nlnet /nix/store/d5dv3b5r919hvknf248xvw6rwa5ggbf1-plasma-workspace-5.27.5/bin/plasmashell 117 3 1955567 nlnet /nix/store/3igqa8akmyswkanm6vpk11if4fiqrji8-firefox-113.0.2/bin/.firefox-wrapped --name firefox 114 1 1955198 nlnet /nix/store/cm63hmpc7976x74f344bbg7pa7grj0i6-thunderbird-102.10.1/bin/.thunderbird-wrapped --name thunderbird 19 1 2065953 nlnet /nix/store/0wyqlfsi1gpnqbvy9pkmlbz91vbly65r-rust-analyzer-unwrapped-2022-10-31/bin/rust-analyzer 18 3 392486 nlnet /nix/store/75wxj2a3c0pdbf46bzmff8qr9vbjm5y1-systemd-253.3/lib/systemd/systemd --user 8 1 392718 nlnet /nix/store/w2rxmc5wqlw28r23rrsvl1qwxq3qlhra-dbus-1.14.6/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile 8 1 1954664 nlnet dbus-daemon --nofork --print-address 4 --session 4 1 1954967 nlnet /nix/store/pil9rmdpn1j73j21bbcx60pgcanv30zh-kactivitymanagerd-5.27.5/libexec/kactivitymanagerd 3 3 1945296 nlnet /nix/store/3a566gibjcsrmi0pbdndqpfdpv37wh6a-wireplumber-0.4.14/bin/wireplumber 2 2 410389 nlnet gpg-agent --homedir /home/nlnet/.gnupg --use-standard-socket --daemon 2 1 1954928 nlnet /nix/store/2nhjxk2jcxp6z64iv9r1yxpbafajpjc7-powerdevil-5.27.5/libexec/org_kde_powerdevil 1 1 2037433 nlnet /home/nlnet/.nix-profile/bin/konsole 1 1 2035949 nlnet /nix/store/v7qc7q2w1ji5v0a4gyrh36bm1vxqqvz0-kwallet-5.106.0-bin/bin/kwalletd5 1 1 1954954 nlnet /run/current-system/sw/bin/gmenudbusmenuproxy 1 1 1954704 nlnet /nix/store/dvwkf9i5vyffqs6bn001ili2f94nrqx8-xdg-desktop-portal-1.16.0/libexec/xdg-desktop-portal 115922 WATCHES TOTAL COUNT INotify instances per user (e.g. limits specified by fs.inotify.max_user_instances): INSTANCES USER ----------- ------------------ 29 nlnet ``` Elisa uses 100% CPU while setting all these watches. After running for a few minutes, the watch capacity needs to be increased again. At this point the number of watches is 123674. Increasing the limit more does not create more watches. The limit is at 124304 (`cat /proc/sys/fs/inotify/max_user_watches`). Since elisa has taken all the available inotify watches, other applications cannot set any watches. Closing elisa frees up the watches.
Created attachment 159800 [details] popup about the need for more watches
Created attachment 159801 [details] Dialog for increasing the number of watches
Created attachment 159802 [details] Script to show the number of watches per application