Bug 488439 - Baloo doubles battery drainage
Summary: Baloo doubles battery drainage
Status: RESOLVED MOVED
Alias: None
Product: frameworks-baloo
Classification: Frameworks and Libraries
Component: Baloo File Daemon (show other bugs)
Version: 6.2.0
Platform: NixOS Linux
: NOR grave
Target Milestone: ---
Assignee: baloo-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-13 09:22 UTC by contact
Modified: 2024-06-19 10:34 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 contact 2024-06-13 09:22:19 UTC
SUMMARY
When baloo_file_explorer is running, it uses about 20w of energy on it's own. This halves my battery life.

STEPS TO REPRODUCE
1. get a device with a battery
2. Disable Baloo (if it is running) 
3. Measure Battery Drain (powertop)
4. Enable Baloo (if it is done indexing either give it a new directory to index or clear the index)
5. Measure Battery Drain again

OBSERVED RESULT
Baloo uses 20 watts on my machine.

EXPECTED RESULT
Something slightly more reasonable.

SOFTWARE/OS VERSIONS
Operating System: NixOS 24.11
KDE Plasma Version: 6.0.5
KDE Frameworks Version: 6.2.0
Qt Version: 6.7.1
Kernel Version: 6.6.32 (64-bit)
Graphics Platform: Wayland
Processors: 16 × AMD Ryzen 7 7840HS w/ Radeon 780M Graphics
Memory: 27.1 GiB of RAM
Graphics Processor: AMD Radeon Graphics

SUGGESTIONS:
I think Baloo needs an overhaul. I am having so many issues with it. The file search behavior I am experiencing in Plasma has always been so unhelpful that I never use it and I have the bug that baloo keeps getting to around 79 percent of indexed files and never finishes indexing.

But this rework will need a lot of time and effort.

So for the time being, I would recommend to just disable it when the system runs on battery. Or at least give an option to do so.
Comment 1 contact 2024-06-13 12:47:38 UTC
ADDITIONAL CONTEXT:
#488446 is probably related.
Comment 2 tagwerk19 2024-06-13 16:36:50 UTC
You can watch how content indexing is progressing with by running:
    balooctl monitor
Normally you'd see it index a batch of 40 files, pause, index the next batch, etc, etc...

See what
    htop
says about baloo_file_extractor, it is running?

Check
    systemctl --user status kde-baloo

Do you notice the indexing affecting system performance?
Comment 3 contact 2024-06-14 07:35:39 UTC
(In reply to tagwerk19 from comment #2)
> balooctl monitor
File indexer is running
Indexing file content

> See what
>     htop
> says about baloo_file_extractor, it is running?

It is running and using 40% CPU and ~670 M/s R/W

> 
> Check
>     systemctl --user status kde-baloo

● kde-baloo.service - Baloo File Indexer Daemon
     Loaded: loaded (]8;;file://workframe/run/current-system/sw/share/systemd/user/kde-baloo.serviceG/run/current-system/sw/share/systemd/user/kde-baloo.service]8;;G; linked-runtime; preset: enabled)
     Active: active (running) since Fri 2024-06-14 09:18:13 CEST; 15min ago
    Process: 1927 ExecCondition=/run/current-system/sw/bin/kde-systemd-start-condition --condition baloofilerc:Basic Settings:Indexing-Enabled:true (code=exited, status=0/SUCCESS)
   Main PID: 1932 (.baloo_file-wra)
      Tasks: 5 (limit: 33421)
     Memory: 512.2M (high: 512.0M available: 0B peak: 513.0M swap: 1.1G swap peak: 1.1G)
        CPU: 6min 17.477s
     CGroup: /user.slice/user-1000.slice/user@1000.service/background.slice/kde-baloo.service
             ├─1932 /nix/store/n96bf9mshy8wcz4kmhfazlm3383b7rnf-baloo-6.2.0/libexec/kf6/baloo_file
             └─2618 /nix/store/n96bf9mshy8wcz4kmhfazlm3383b7rnf-baloo-6.2.0/libexec/kf6/baloo_file_extractor

Jun 14 09:18:13 workframe systemd[1892]: Starting Baloo File Indexer Daemon...
Jun 14 09:18:13 workframe systemd[1892]: Started Baloo File Indexer Daemon.
Jun 14 09:18:18 workframe baloo_file_extractor[2618]: kf.idletime: Could not find any system poller plugin
Jun 14 09:18:18 workframe baloo_file_extractor[2618]: qt.core.qobject.connect: QObject::connect(KAbstractIdleTimePoller, KIdleTime): invalid nullptr parameter
Jun 14 09:18:18 workframe baloo_file_extractor[2618]: qt.core.qobject.connect: QObject::connect(KAbstractIdleTimePoller, KIdleTime): invalid nullptr parameter
Jun 14 09:18:37 workframe baloo_file_extractor[2618]: qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile
Jun 14 09:18:37 workframe baloo_file_extractor[2618]: qt.gui.imageio: libpng warning: iCCP: known incorrect sRGB profile

> Do you notice the indexing affecting system performance?
My system performs pretty poorly when it has run out of battery. ;) And it is annoying to always hear fans spin when doing basic office work.
But it is not less responsive.
Comment 4 tagwerk19 2024-06-17 11:47:18 UTC
I'm guessing from the troubleshooting in Bug 488533 and excluding files with mimetype "model/obj" from the content indexing, this is OK now and can be closed..
Comment 5 contact 2024-06-17 11:53:06 UTC
(In reply to tagwerk19 from comment #4)
> I'm guessing from the troubleshooting in Bug 488533 and excluding files with
> mimetype "model/obj" from the content indexing, this is OK now and can be
> closed..

I intentionally created two bugs, as one issue is:
 - what is happening to me, why is baloo stuck
and the other one is
 - why is baloo so bad for battery life when it is stuck?

Because I think there is a discussion to be had about disabling baloo on battery or some power consumption optimizations, that could mitigate the impact it has on a lapop when you add a bunch of files.
Comment 6 tagwerk19 2024-06-17 13:02:08 UTC
(In reply to contact from comment #5)
> ... why is baloo so bad for battery life when it is stuck? ...
When it is stuck? That's not going to be easy to find out ...

In normal operation, Baloo checks whether the system is running on battery and stops content indexing. At least as far as I remember...
Comment 7 contact 2024-06-17 13:38:33 UTC
This battery saving feature is - if it exists - is 100% not working on my machine.
Comment 8 tagwerk19 2024-06-17 17:06:13 UTC
(In reply to contact from comment #7)
> This battery saving feature is - if it exists - is 100% not working on my
> machine.
I think it exists (but don't have a laptop to test), there is code to query the PowerManagement via DBus ...

... This may be a distro thing
Comment 9 tagwerk19 2024-06-17 17:11:46 UTC
(In reply to tagwerk19 from comment #8)
> ... This may be a distro thing
This may be a naive suggestion but...
... https://mynixos.com/nixpkgs/option/powerManagement.enable
Comment 10 contact 2024-06-19 10:31:03 UTC
Oh dear nixos.
I have several options that belong to power management enabled but of course not power management itself.
*sigh*

Okay I think it is fair to close this. The power management thing was user error/distro confusion.
Comment 11 contact 2024-06-19 10:34:24 UTC
Resolved, because:
 - baloo was generating a huge index due to issues when parsing obj files
 - PowerManagement on my machine was not available due to user error

Nixos is really really great, but also really really confusing and poorly documented.