Bug 475695 - baloo_file_extractor crash on login
Summary: baloo_file_extractor crash on login
Alias: None
Product: frameworks-baloo
Classification: Frameworks and Libraries
Component: Baloo File Daemon (show other bugs)
Version: 5.110.0
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: baloo-bugs-null
Keywords: drkonqi
: 477404 479881 481105 483373 (view as bug list)
Depends on:
Reported: 2023-10-16 13:29 UTC by Zack Weinberg
Modified: 2024-03-14 19:35 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Zack Weinberg 2023-10-16 13:29:37 UTC
Application: baloo_file_extractor (5.110.0)
 (Compiled from sources)
Qt Version: 5.15.10
Frameworks Version: 5.110.0
Operating System: Linux 6.1.53-gentoo-r1 x86_64
Windowing System: X11
Distribution: "Gentoo Linux"
DrKonqi: 5.27.8 [KCrashBackend]

-- Information about the crash:
baloo_file_extractor crashes immediately upon logging in. Didn't used to do this but has started doing it in the past two days.

balooctl status reports:

Baloo File Indexer is running
Indexer state: Idle
Total files indexed: 146,682
Files waiting for content indexing: 15
Files failed to index: 4
Current size of index is 2.22 GiB

I think it's very likely that the problem is with one of those 19 files but, in order to get any more detail, I need to exit drkonqi so I can restart the extractor, so I'll add that in follow-ups.

The crash can be reproduced every time.

-- Backtrace:
Application: Baloo File Extractor (baloo_file_extractor), signal: Segmentation fault
Content of s_kcrashErrorMessage: std::unique_ptr<char []> = {get() = 0x0}
[KCrash Handler]
#6  __memcpy_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:837
#7  0x00007fbf1fa110b6 in mdb_page_touch (mc=mc@entry=0x7ffe8dc1adf0) at mdb.c:2502
#8  0x00007fbf1fa12c9c in mdb_cursor_touch (mc=mc@entry=0x7ffe8dc1adf0) at mdb.c:6563
#9  0x00007fbf1fa16228 in mdb_cursor_put (mc=mc@entry=0x7ffe8dc1adf0, key=key@entry=0x7ffe8dc1b1e0, data=data@entry=0x7ffe8dc1b1f0, flags=<optimized out>, flags@entry=0) at mdb.c:6697
#10 0x00007fbf1fa18d51 in mdb_put (txn=0x55986d167a70, dbi=<optimized out>, key=0x7ffe8dc1b1e0, data=0x7ffe8dc1b1f0, flags=0) at mdb.c:9076
#11 0x00007fbf1fcec44b in Baloo::PostingDB::put (this=this@entry=0x7ffe8dc1b2d0, term=..., list=...) at /usr/src/debug/kde-frameworks/baloo-5.110.0/baloo-5.110.0/src/engine/postingdb.cpp:66
#12 0x00007fbf1fcfcf1c in Baloo::WriteTransaction::commit (this=<optimized out>) at /usr/src/debug/kde-frameworks/baloo-5.110.0/baloo-5.110.0/src/engine/writetransaction.cpp:329
#13 0x00007fbf1fcf4ddf in Baloo::Transaction::commit (this=0x7fbf140113f0) at /usr/src/debug/kde-frameworks/baloo-5.110.0/baloo-5.110.0/src/engine/transaction.cpp:285
#14 0x000055986ba512bc in Baloo::App::processNextFile (this=0x7ffe8dc1b830) at /usr/src/debug/kde-frameworks/baloo-5.110.0/baloo-5.110.0/src/file/extractor/app.cpp:109
#15 0x00007fbf1f0bbb02 in QtPrivate::QSlotObjectBase::call (a=0x7ffe8dc1b420, r=<optimized out>, this=<optimized out>) at /usr/src/debug/dev-qt/qtcore-5.15.10-r2/qtbase-everywhere-src-5.15.10/include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#16 QSingleShotTimer::timerEvent (this=0x55986d2c7800) at /usr/src/debug/dev-qt/qtcore-5.15.10-r2/qtbase-everywhere-src-5.15.10/src/corelib/kernel/qtimer.cpp:322
#17 0x00007fbf1f0af475 in QObject::event (this=0x55986d2c7800, e=0x7ffe8dc1b550) at /usr/src/debug/dev-qt/qtcore-5.15.10-r2/qtbase-everywhere-src-5.15.10/src/corelib/kernel/qobject.cpp:1369
#18 0x00007fbf1f084268 in QCoreApplication::notifyInternal2 (receiver=0x55986d2c7800, event=0x7ffe8dc1b550) at /usr/src/debug/dev-qt/qtcore-5.15.10-r2/qtbase-everywhere-src-5.15.10/src/corelib/kernel/qcoreapplication.cpp:1064
#19 0x00007fbf1f08445e in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at /usr/src/debug/dev-qt/qtcore-5.15.10-r2/qtbase-everywhere-src-5.15.10/src/corelib/kernel/qcoreapplication.cpp:1462
#20 0x00007fbf1f0d5289 in QTimerInfoList::activateTimers (this=0x55986d13d460) at /usr/src/debug/dev-qt/qtcore-5.15.10-r2/qtbase-everywhere-src-5.15.10/src/corelib/kernel/qtimerinfo_unix.cpp:643
#21 0x00007fbf1f0d5b51 in timerSourceDispatch (source=<optimized out>) at /usr/src/debug/dev-qt/qtcore-5.15.10-r2/qtbase-everywhere-src-5.15.10/src/corelib/kernel/qeventdispatcher_glib.cpp:183
#22 0x00007fbf1e08663c in g_main_dispatch (context=0x7fbf14000ee0) at ../glib-2.76.4/glib/gmain.c:3460
#23 g_main_context_dispatch (context=context@entry=0x7fbf14000ee0) at ../glib-2.76.4/glib/gmain.c:4200
#24 0x00007fbf1e0868e8 in g_main_context_iterate (context=context@entry=0x7fbf14000ee0, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib-2.76.4/glib/gmain.c:4276
#25 0x00007fbf1e08697c in g_main_context_iteration (context=0x7fbf14000ee0, may_block=1) at ../glib-2.76.4/glib/gmain.c:4343
#26 0x00007fbf1f0d5ee6 in QEventDispatcherGlib::processEvents (this=0x55986d136480, flags=...) at /usr/src/debug/dev-qt/qtcore-5.15.10-r2/qtbase-everywhere-src-5.15.10/src/corelib/kernel/qeventdispatcher_glib.cpp:423
#27 0x00007fbf1f082c8b in QEventLoop::exec (this=this@entry=0x7ffe8dc1b790, flags=..., flags@entry=...) at /usr/src/debug/dev-qt/qtcore-5.15.10-r2/qtbase-everywhere-src-5.15.10/include/QtCore/../../src/corelib/global/qflags.h:69
#28 0x00007fbf1f08af66 in QCoreApplication::exec () at /usr/src/debug/dev-qt/qtcore-5.15.10-r2/qtbase-everywhere-src-5.15.10/include/QtCore/../../src/corelib/global/qflags.h:121
#29 0x00007fbf1f51c3cc in QGuiApplication::exec () at /usr/src/debug/dev-qt/qtgui-5.15.10-r2/qtbase-everywhere-src-5.15.10/src/gui/kernel/qguiapplication.cpp:1870
#30 0x000055986ba4f440 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kde-frameworks/baloo-5.110.0/baloo-5.110.0/src/file/extractor/main.cpp:43
[Inferior 1 (process 2829) detached]

Reported using DrKonqi
Comment 1 Zack Weinberg 2023-10-16 13:41:23 UTC
I can't figure out how to restart baloo_file_extractor by hand after this crash.

"balooctl enable" says the indexer is already running, which is not true per ps.  If I run baloo_file_extractor in a terminal window, it hangs; strace tells me it's stuck in a loop reading the same 8-byte binary string ("\1\0\0\0\0\0\0\0") from an "eventfd", whatever that is, and "balooctl enable" or "balooctl check" doesn't kick it into doing anything useful.  It doesn't have a manpage nor does it accept --help.  I had "balooctl monitor" running the entire time and it only says

Press ctrl+c to stop monitoring
File indexer is running

Please advise how to troubleshoot further.
Comment 2 Zack Weinberg 2023-10-16 13:44:49 UTC
This doesn't look right to me:

$ ls -lh ~/.local/share/baloo
total 2.3G
-rw-r--r-- 1 zack zack 2.3G Oct 13 11:43 index
-rw-r--r-- 1 zack zack 8.0K Oct 16 09:43 index-lock

$ mdb_stat -n ~/.local/share/baloo/index
Status of Main DB
  Tree depth: 1
  Branch pages: 0
  Leaf pages: 1
  Overflow pages: 0
  Entries: 12
Comment 3 Zack Weinberg 2023-10-16 14:56:34 UTC
It turns out I was using mdb_stat wrong, and the index _isn't_ a giant mostly-empty shell.  However, mdb_copy -c also crashes inside memcpy when applied to the index file, and mdb_dump -apn prints

/usr/bin/mdb_dump: index: MDB_BAD_TXN: Transaction must abort, has a child, or is invalid

so I think it's probably safe to assume that the original crash is due to database corruption, and if there's any fix to be had, it belongs inside liblmdb.  I have moved the bad index file out of the way and directed baloo to reindex from scratch, and I'll let you know if it actually trips up on any of my files.
Comment 4 Zack Weinberg 2023-10-16 17:56:34 UTC
A reindex from scratch ran to completion with no issues.

$ balooctl status
Baloo File Indexer is running
Indexer state: Idle
Total files indexed: 143,490
Files waiting for content indexing: 0
Files failed to index: 0
Current size of index is 1.82 GiB

I filed https://bugs.openldap.org/show_bug.cgi?id=10114 for the underlying database corruption problem.
Comment 5 tagwerk19 2023-10-17 07:43:25 UTC
You could try Igor Poboiko's baloo-checkdb.py "consistency check" script:


There's a quick description here:


Heads up about the need to load the whole database into memory. It waves a flag about possible corruptions, doesn't try to fix them.

Sorry, I don't a step by step install instructions for Gentoo...
Comment 6 Zack Weinberg 2023-10-17 13:25:12 UTC
$ python3 dl/baloo-checkdb.py .local/share/baloo.bad/index
Loading DB from .local/share/baloo.bad/index...
Traceback (most recent call last):
  File "/home/zack/dl/baloo-checkdb.py", line 265, in <module>
  File "/home/zack/dl/baloo-checkdb.py", line 235, in check
  File "/home/zack/dl/baloo-checkdb.py", line 52, in load_all
  File "/home/zack/dl/baloo-checkdb.py", line 87, in _load_posting
    for (key, value) in txn.cursor():
lmdb.PageNotFoundError: mdb_cursor_get: MDB_PAGE_NOTFOUND: Requested page not found
Comment 7 Christoph Cullmann 2024-03-14 18:50:11 UTC
*** Bug 477404 has been marked as a duplicate of this bug. ***
Comment 8 Christoph Cullmann 2024-03-14 19:29:29 UTC
*** Bug 481105 has been marked as a duplicate of this bug. ***
Comment 9 Christoph Cullmann 2024-03-14 19:33:29 UTC
*** Bug 483373 has been marked as a duplicate of this bug. ***
Comment 10 Christoph Cullmann 2024-03-14 19:35:42 UTC
*** Bug 479881 has been marked as a duplicate of this bug. ***