Bug 391253 - a baloo_file process continue to run when X session is stopped
Summary: a baloo_file process continue to run when X session is stopped
Status: RESOLVED FIXED
Alias: None
Product: frameworks-baloo
Classification: Frameworks and Libraries
Component: Baloo File Daemon (show other bugs)
Version: 5.43.0
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: baloo-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-03-01 10:55 UTC by Bruno Friedmann
Modified: 2020-10-26 16:00 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.21


Attachments
baloo_file gdb trace with thread apply all bt (3.74 KB, text/plain)
2018-03-01 10:55 UTC, Bruno Friedmann
Details
Patch helping in closing baloo_file (3.23 KB, patch)
2018-03-01 10:55 UTC, Bruno Friedmann
Details
baloo_file lsof example (9.30 KB, text/plain)
2018-03-01 10:56 UTC, Bruno Friedmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Friedmann 2018-03-01 10:55:03 UTC
Created attachment 111107 [details]
baloo_file gdb trace with thread apply all bt

I've detected that there's always a running baloo_file process belonging to my userid even if I've logout from Xorg, and no sessions are still running.

We tried to fix it (see proposed patch) but there's still problems.
Can we have some inputs from upstream ?
Comment 1 Bruno Friedmann 2018-03-01 10:55:59 UTC
Created attachment 111108 [details]
Patch helping in closing baloo_file
Comment 2 Bruno Friedmann 2018-03-01 10:56:44 UTC
Created attachment 111109 [details]
baloo_file lsof example

Here the list of file open by baloo_file
Comment 3 Bruno Friedmann 2018-03-01 11:03:31 UTC
balooctl status
Baloo File Indexer is running
Indexer state: Idle
Indexed 186431 / 186431 files
Current size of index is 11,41 GiB

balooctl indexSize
Actual Size: 11,41 GiB
Expected Size: 8,73 GiB

           PostingDB:       2,19 GiB   298.355 %
         PosistionDB:       3,50 GiB   477.935 %
            DocTerms:       1,66 GiB   226.418 %
    DocFilenameTerms:      17,77 MiB     2.366 %
       DocXattrTerms:            0 B     0.000 %
              IdTree:       3,45 MiB     0.460 %
          IdFileName:      13,59 MiB     1.811 %
             DocTime:       8,30 MiB     1.106 %
             DocData:      20,01 MiB     2.666 %
   ContentIndexingDB:            0 B     0.000 %
         FailedIdsDB:            0 B     0.000 %
             MTimeDB:       3,84 MiB     0.512 %

To be clear, if I issue the balooctl stop command the process die correctly.
But that should be the case if I logout of plasma5.
Comment 4 Michael Heidelbach 2018-03-01 11:32:00 UTC
Same for me. 
It has been on my to-do list for quite some time now.

Regarding your patch, thanks, I'll test it. If you post it on phabricator.kde.org within the next few days and it's valid, you'll get all the merits. Otherwise I will :-)
Comment 5 Bruno Friedmann 2018-03-01 11:59:05 UTC
Hi Michael, unfortunately the patch is not ok. the gdb attached is after applying it. 
And credits goes to Fabian.

We can eventually work on phab, but I guess once we have a real and complete solution.
If you find complementary code to fix, I can quite easily integrate it, build and test.
Comment 6 Fabian Vogt 2018-03-01 12:03:12 UTC
(In reply to Michael Heidelbach from comment #4)
> Same for me. 
> It has been on my to-do list for quite some time now.
> 
> Regarding your patch, thanks, I'll test it. If you post it on
> phabricator.kde.org within the next few days and it's valid, you'll get all
> the merits. Otherwise I will :-)

The patch is just a workaround for two bugs:

a) The quit() method on FileContentIndexer doesn't exit the event loop of the thread.
b) The ExtractorProcess gets stuck if the QProcess dies for whatever reason.

The workaround for a) will just terminate the event loop, whatever side effects that might cause. The workaround for b) emits done() if the process dies or quits, which isn't good either.
Comment 7 Michael Heidelbach 2018-03-01 14:07:11 UTC
(In reply to Bruno Friedmann from comment #3)
> To be clear, if I issue the balooctl stop command the process die correctly.
> But that should be the case if I logout of plasma5.
It also exits with this: 
$ cat <<EOF>~/.config/plasma-workspace/shutdown/stop-baloo
#!/bin/bash
balooctl stop
EOF
$ chmod +x ~/.config/plasma-workspace/shutdown/stop-baloo

A workaround, of course.
Comment 8 Nate Graham 2020-10-26 16:00:43 UTC
This will be fixed in Plasma 5.21 with systemd startup; Baloo is now run as a systemd unit all of whose children will be stopped on logout.