Bug 474346 - baloo_file_extractor fills swap space even though there's plenty of RAM available
Summary: baloo_file_extractor fills swap space even though there's plenty of RAM avail...
Status: RESOLVED NOT A BUG
Alias: None
Product: frameworks-baloo
Classification: Frameworks and Libraries
Component: Baloo File Daemon (show other bugs)
Version: 5.109.0
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: baloo-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-09 19:51 UTC by Branimir Amidzic
Modified: 2023-09-10 21:28 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Branimir Amidzic 2023-09-09 19:51:47 UTC
SUMMARY
baloo_file_extractor fills swap space even though there's plenty of RAM available.


STEPS TO REPRODUCE
1. Verify that file search (including file contents) is enabled and that the files have been indexed.
2. Check RAM and swap file usage. If there's plenty of RAM available and swap usage is couple of GB try following steps.
3. Open System activity (CTRL+ESC) and stop baloo_file_extractor (right click on baloo_file_extractor and go to Send signal -> STOP).
4. Remove swap file (swapoff -a)
5. Mount swap file (swapon -a)
6. Verify that swap usage is around 0%.
7. Resume baloo_file_extractor (Send signal -> CONT)
8. Monitor swap file usage. It should go up very quickly after you resume baloo_file_extractor.

OBSERVED RESULT
After starting or resuming baloo_file_extractor swap file usage goes up very quickly although there's plenty of RAM available.

EXPECTED RESULT
baloo_file_extractor should use RAM if it's available and use swap only if there's no RAM available

SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.109.0
Qt Version: 5.15.10
Kernel Version: 6.4.12-arch1-1 (64-bit)
Graphics Platform: X11
Processors: 12 × 12th Gen Intel® Core™ i5-1235U
Memory: 31,0 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Manufacturer: Dell Inc.
Product Name: Latitude 5530

ADDITIONAL INFORMATION
I haven't noticed similar with previous versions of KDE/Plasma/Baloo.
I have set "vm.swappiness=10". It should use swap even less. I use swap file (not swap partition).
Comment 1 tagwerk19 2023-09-10 06:35:03 UTC
Two things to check...

Is baloo running with the systemd memory limits? There's been a recent change to limit baloo to using 512 MB. You can check with:
    $ systemctl status --user kde-baloo
and look at "high" value in the "Memory:" line.

This can tip baloo_file and baloo_file_extractor over to using swap. Have a look at:
    https://bugs.kde.org/show_bug.cgi?id=470382#c1

It's also possible you are hitting a file that does not want to be indexed. Baloo_file_extractor tries to get readable text out of a file and some times this just does not work in the time and space available (examples being a multi-gigabyte .mbox file or large scientific graphs in a PDF). You would need to watch, with "balooctl monitor" what was being indexed.
Comment 2 Branimir Amidzic 2023-09-10 21:28:02 UTC
(In reply to tagwerk19 from comment #1)
> Two things to check...
> 
> Is baloo running with the systemd memory limits? There's been a recent
> change to limit baloo to using 512 MB. You can check with:
>     $ systemctl status --user kde-baloo
> and look at "high" value in the "Memory:" line.
> 
> This can tip baloo_file and baloo_file_extractor over to using swap. Have a
> look at:
>     https://bugs.kde.org/show_bug.cgi?id=470382#c1
> 
> It's also possible you are hitting a file that does not want to be indexed.
> Baloo_file_extractor tries to get readable text out of a file and some times
> this just does not work in the time and space available (examples being a
> multi-gigabyte .mbox file or large scientific graphs in a PDF). You would
> need to watch, with "balooctl monitor" what was being indexed.

Thanks! It seems this was false alarm.
I guess that baloo_file_extractor behaves this way only when indexing files. Now, after it has finished indexing, the swap usage is back to 0%.
Sorry for raising flags...