Bug 435521

Summary: baloo_file_extractor hangs after indexing 40 files...
Product: [Frameworks and Libraries] frameworks-baloo Reporter: tagwerk19
Component: Baloo File DaemonAssignee: Stefan Brüns <stefan.bruens>
Status: RESOLVED FIXED    
Severity: normal CC: baloo-bugs-null, jan.rathmann, nate
Priority: NOR    
Version: 5.81.0   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Screen capture with working indexing
Screen capture with indexing "hanging"

Description tagwerk19 2021-04-08 18:26:27 UTC
SUMMARY

    baloo_file_extractor hangs after recent Neon Testing update
    (from git20210331.0152-0 to git20210408.0239-0)

STEPS TO REPRODUCE:

    After update and reboot, there is a persistant baloo_file_extractor
    process

        $ ps ax | grep baloo

           1016 ?        SNl    0:00 /usr/bin/baloo_file
           1262 ?        SNl    0:00 /usr/bin/baloo_file_extractor
           2192 pts/1    S+     0:00 grep --color=auto baloo

    If you try to query the status:

        $ balooctl status

    hangs. Monitoring the indexing:

        $ balooctl monitor

    pauses at an indeterminate point and does not show "completion"
    of indexing. If you try to query which file is being indexed:

        $ qdbus org.kde.baloo /fileindexer org.kde.baloo.fileindexer.currentFile

    on the assumption that this is still supported, gives just a blank line. 

    Trying to purge the database

        $ balooctl purge

    times out when trying to stop the indexing process.

    Manually killing the processes, deleting the index and re-enabling
    indexing does not solve the problem.

OBSERVED RESULTS

    baloo_file_extractor seems to randomly(?) hang, tried various (simple)
    steps to pin down the problem but without success.

SOFTWARE/OS VERSIONS

    Neon Testing

    Baloo : 5.81.0
    Plasma : 5.21.4
    Frameworks : 5.81.0
    Qt : 5.15.2

ADDITIONAL INFORMATION

    This sounds very similar to the problem described in Bug 435119

    These work OK:

        $ apt list --installed | grep baloo

        baloo-kf5/now 5.80.0+p20.04+tunstable+git20210331.0152-0 amd64 [installed,upgradable to: 5.80.0+p20.04+tunstable+git20210408.0239-0]
        libkf5baloo5/now 5.80.0+p20.04+tunstable+git20210331.0152-0 amd64 [installed,upgradable to: 5.80.0+p20.04+tunstable+git20210408.0239-0]
        libkf5balooengine5/now 5.80.0+p20.04+tunstable+git20210331.0152-0 amd64 [installed,upgradable to: 5.80.0+p20.04+tunstable+git20210408.0239-0]
        libkf5baloowidgets-bin/focal,now 4:20.12.3+p20.04+git20210319.0040-0 amd64 [installed,automatic]
        libkf5baloowidgets5/focal,now 4:20.12.3+p20.04+git20210319.0040-0 amd64 [installed,automatic]

    These fail (Neon Testing ISO, neon-testing-20210406-1819.iso):

        baloo-kf5/focal,now 5.80.0+p20.04+tunstable+git20210406.0126-0 amd64 [installed,upgradable to: 5.80.0+p20.04+tunstable+git20210408.0239-0]
        libkf5baloo5/focal,now 5.80.0+p20.04+tunstable+git20210406.0126-0 amd64 [installed,upgradable to: 5.80.0+p20.04+tunstable+git20210408.0239-0]
        libkf5balooengine5/focal,now 5.80.0+p20.04+tunstable+git20210406.0126-0 amd64 [installed,upgradable to: 5.80.0+p20.04+tunstable+git20210408.0239-0]
        libkf5baloowidgets-bin/focal,now 4:20.12.3+p20.04+git20210319.0040-0 amd64 [installed,automatic]
        libkf5baloowidgets5/focal,now 4:20.12.3+p20.04+git20210319.0040-0 amd64 [installed,automatic]

    If you update, these still fail:

        baloo-kf5/focal,now 5.80.0+p20.04+tunstable+git20210408.0239-0 amd64 [installed,automatic]
        libkf5baloo5/focal,now 5.80.0+p20.04+tunstable+git20210408.0239-0 amd64 [installed,automatic]
        libkf5balooengine5/focal,now 5.80.0+p20.04+tunstable+git20210408.0239-0 amd64 [installed,automatic]
        libkf5baloowidgets-bin/focal,now 4:20.12.3+p20.04+git20210319.0040-0 amd64 [installed,automatic]
        libkf5baloowidgets5/focal,now 4:20.12.3+p20.04+git20210319.0040-0 amd64 [installed,automatic]
Comment 1 tagwerk19 2021-04-10 19:04:11 UTC
SOFTWARE/OS VERSIONS

    A fresh installation of Neon Unstable, neon-unstable-20210404-0329.iso:

    $ apt list --installed | grep baloo

    baloo-kf5/now 5.80.0+p20.04+tunstable+ amd64 [installed,upgradable to: 5.80.0+p20.04+tunstable+git20210408.0239-0]
    libkf5baloo5/now 5.80.0+p20.04+tunstable+git20210404.0240-0 amd64 [installed,upgradable to: 5.80.0+p20.04+tunstable+git20210408.0239-0]
    libkf5balooengine5/now 5.80.0+p20.04+tunstable+git20210404.0240-0 amd64 [installed,upgradable to: 5.80.0+p20.04+tunstable+git20210408.0239-0]
    libkf5baloowidgets-bin/focal,now 4:20.12.3+p20.04+git20210314.0020-0 amd64 [installed,automatic]
    libkf5baloowidgets5/focal,now 4:20.12.3+p20.04+git20210314.0020-0 amd64 [installed,automatic] 

STEPS TO REPRODUCE

    Restrict indexing to a single folder ~/Testdir; in .config/baloofilerc:

        exclude folders[$e]=$HOME/
        folders[$e]=$HOME/Testdir/

    Run, in one window:

        balooctl monitor

    Create a set of 100 testfiles in a second window with the bash script:

        cd ~/Testdir
        for i in {1..100}; do echo "This is file $i" > file$i.txt; done

OBSERVED RESULTS

    "balooctl monitor" shows baloo indexing the first 40 files and stopping.

EXPECTED RESULTS

    "balooctl monitor" shows baloo indexing 100 files and then says "Idle"

ADDITIONAL INFORMATION

    It may, of course, be that comparing the behaviour of a "Neon Unstable"
    and a "Neon Testing" is not exactly comparing Apples with Apples but
    the indication is that the change came in between:

        git20210404.0240-0

    and...

        git20210406.0126-0
Comment 2 tagwerk19 2021-04-10 19:18:38 UTC
(In reply to tagwerk19 from comment #1)
> SOFTWARE/OS VERSIONS
Messed up a bit here, apologies:

The installed "neon-unstable-20210404-0329.iso" worked:
    It gave the "Expected Results"

After the system was updated (which took it to the 20210408 code):
    It gave the "Observed Results"

It's not possible to be too careful :-/
Comment 3 tagwerk19 2021-04-11 08:47:45 UTC
Created attachment 137499 [details]
Screen capture with working indexing

Neon Unstable "as per" 20210404, running:

    apt list --installed | grep baloo
    cat .config/baloofilerc
    balooctl monitor

and then creating 100 testfiles.
Comment 4 tagwerk19 2021-04-11 08:53:56 UTC
Created attachment 137500 [details]
Screen capture with indexing "hanging"

Neon Unstable "as per" 20210411, running:

    apt list --installed | grep baloo
    cat .config/baloofilerc
    balooctl monitor

and then creating 100 testfiles.

Killing the baloo_file_extractor process when it "hung" after indexing 40 files, (and again after another 20 files, 10 files, 5 files, 2 files, 1 file...)
Comment 5 tagwerk19 2021-04-13 06:20:35 UTC
After Frameworks 5.81.0 release

    https://kde.org/announcements/frameworks/5/5.81.0/

Checked Neon User Edition (neon-user-20210401-0944.iso, updated to 2021-04-13 state)

    $ apt list --installed | grep baloo

    baloo-kf5/focal,now 5.81.0-0xneon+20.04+focal+release+build23 amd64 [installed,automatic]
    libkf5baloo5/focal,now 5.81.0-0xneon+20.04+focal+release+build23 amd64 [installed,automatic]
    libkf5balooengine5/focal,now 5.81.0-0xneon+20.04+focal+release+build23 amd64 [installed,automatic]
    libkf5baloowidgets-bin/focal,now 4:20.12.3-0xneon+20.04+focal+build15 amd64 [installed,automatic]
    libkf5baloowidgets5/focal,now 4:20.12.3-0xneon+20.04+focal+build15 amd64 [installed,automatic]

Shows no problems.
Comment 6 Jan Rathmann 2021-04-14 19:54:32 UTC
Seems I can't reproduce that in my VM with Neon Testing...
Comment 7 tagwerk19 2021-04-14 20:21:52 UTC
(In reply to Jan Rathmann from comment #6)
> Seems I can't reproduce that in my VM with Neon Testing...
Thank you for having a look...
Comment 8 tagwerk19 2021-04-19 21:06:02 UTC
Tried various combinations but, as far as I can tell, it is "still a thing", at least in my KVM guest testing environment

I see the issue in neon Testing from...

    Baloo: git20210406.0126-0 (git20210404.0240-0 was OK)
    Plasma: 5.21.4
    Frameworks: 5.81.0
    Qt: 5.15.2 

to...

    Baloo: git20210416.0123-0
    Plasma: 5.21.80
    Frameworks: 5.82.0
    Qt: 5.15.2 

Could be I'm missing something in my tests but I'm running out of ideas. If it is real, then it needs to be fixed before reaching the user editions.
Comment 9 Stefan Brüns 2021-04-27 21:38:10 UTC
Git commit 47bf0f33551428556e8e8e8b3100e0c61f90f9a0 by Stefan Brüns.
Committed on 27/04/2021 at 18:55.
Pushed by bruns into branch 'master'.

Port extractorprocess to WorkerPipe/ControllerPipe helper classes

With this change, the communcation between the controlling baloo_file
process and its worker process is now actually tested.

M  +12   -23   src/file/extractor/app.cpp
M  +4    -5    src/file/extractor/app.h
M  +16   -45   src/file/extractorprocess.cpp
M  +3    -3    src/file/extractorprocess.h

https://invent.kde.org/frameworks/baloo/commit/47bf0f33551428556e8e8e8b3100e0c61f90f9a0
Comment 10 tagwerk19 2021-04-28 16:03:33 UTC
(In reply to Stefan Brüns from comment #9)
> With this change, the communcation between the controlling baloo_file
> process and its worker process is now actually tested.

Checked on Neon Testing; "balooctl monitor" shows the stream of files being index, with a slight pause every 40 files (*).

    $ apt list --installed | grep baloo

    baloo-kf5/focal,now 5.81.0+p20.04+tunstable+git20210428.0140-0 amd64 [installed,automatic]
    libkf5baloo5/focal,now 5.81.0+p20.04+tunstable+git20210428.0140-0 amd64 [installed,automatic]
    libkf5balooengine5/focal,now 5.81.0+p20.04+tunstable+git20210428.0140-0 amd64 [installed,automatic]
    libkf5baloowidgets-bin/focal,now 4:21.04.0+p20.04+tstable+git20210419.1043-0 amd64 [installed,automatic]
    libkf5baloowidgets5/focal,now 4:21.04.0+p20.04+tstable+git20210419.1043-0 amd64 [installed,automatic]

Looks so much better. Many thanks!

*) For completeness, there might still be something being "reserved and not released" in baloo_file if baloo_file_extractor dies/is killed. If that happens, indexing _does_ continue but with a pause every 20 files.
Comment 11 tagwerk19 2021-05-10 06:07:19 UTC
Was listed in the the Frameworks 5.82 release...
    https://kde.org/announcements/frameworks/5/5.82.0/
Suspect can now be closed...