In kmail's debug output I see the following: "" Qt has caught an exception thrown from an event handler. Throwing exceptions from an event handler is not supported in Qt. You must reimplement QApplication::notify() and catch all exceptions there. terminate called after throwing an instance of 'std::logic_error' what(): basic_string::_S_construct null not valid "" The backtrace at that point naturally doesn't give anything away. I noticed however on akonadi startup the following also: "" akonadi_baloo_indexer(16245): Failed to create email indexer: "Error opening table `/home/shausman/.local/share/baloo/email//record.': Couldn't open /home/shausman/.local/share/baloo/email//record.baseA: No such file or directory Unable to read revision from /home/shausman/.local/share/baloo/email//record.baseB "" as well as "" Executing search "kmail2-869657646-SearchSession" akonadiserver(16196): Xapian Database does not exist at "/home/shausman/.local/share/baloo/email/" Search done "kmail2-869657646-SearchSession" (without remote search) Result: 0 matches "" In order to get something more useful from gdb I did a "catch throw" to find out where the exception was throw. The first throw was here, where it looks like it can't open that database: "" Catchpoint 2 (exception thrown), 0x00007ffff5825a30 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (gdb) bt #0 0x00007ffff5825a30 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x00007fffe38b99a1 in ChertTable::basic_open(bool, unsigned int) () from /usr/lib/libxapian.so.22 #2 0x00007fffe38bd978 in ChertTable::do_open_to_read(bool, unsigned int) () from /usr/lib/libxapian.so.22 #3 0x00007fffe3898ce1 in ?? () from /usr/lib/libxapian.so.22 #4 0x00007fffe389d770 in ?? () from /usr/lib/libxapian.so.22 #5 0x00007fffe3843086 in Xapian::Database::Database(std::string const&) () from /usr/lib/libxapian.so.22 #6 0x00007fffea95b46b in Baloo::PIM::EmailQuery::exec() () from /usr/lib/libbaloopim.so.4 #7 0x00007ffff112a3e6 in MessageList::Core::Filter::setSearchString (this=0x1e021d0, search=..., options=...) at ../../messagelist/core/filter.cpp:122 #8 0x00007ffff116ece9 in MessageList::Core::Widget::searchTimerFired (this=0xbce250) at ../../messagelist/core/widgetbase.cpp:989 #9 0x00007ffff5c5c87a in QMetaObject::activate (sender=0x1dec6c0, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3539 #10 0x00007ffff5c60a31 in QObject::event (this=0x1dec6c0, e=<optimized out>) at kernel/qobject.cpp:1156 #11 0x00007ffff6179e2c in QApplicationPrivate::notify_helper (this=this@entry=0x6c20f0, receiver=receiver@entry=0x1dec6c0, e=e@entry=0x7fffffffd6c0) at kernel/qapplication.cpp:4567 #12 0x00007ffff61804a0 in QApplication::notify (this=this@entry=0x7fffffffdce0, receiver=receiver@entry=0x1dec6c0, e=e@entry=0x7fffffffd6c0) at kernel/qapplication.cpp:4353 #13 0x00007ffff79b4baa in KApplication::notify (this=0x7fffffffdce0, receiver=0x1dec6c0, event=0x7fffffffd6c0) at ../../kdeui/kernel/kapplication.cpp:311 #14 0x00007ffff5c484dd in QCoreApplication::notifyInternal (this=0x7fffffffdce0, receiver=0x1dec6c0, event=0x7fffffffd6c0) at kernel/qcoreapplication.cpp:953 #15 0x00007ffff5c78323 in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231 #16 QTimerInfoList::activateTimers (this=0x6b9f40) at kernel/qeventdispatcher_unix.cpp:621 #17 0x00007ffff5c75629 in timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:193 #18 idleTimerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:240 #19 0x00007fffed369e04 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #20 0x00007fffed36a048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #21 0x00007fffed36a0ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #22 0x00007ffff5c757a1 in QEventDispatcherGlib::processEvents (this=0x607b20, flags=...) at kernel/qeventdispatcher_glib.cpp:434 #23 0x00007ffff621bbb6 in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204 #24 0x00007ffff5c470af in QEventLoop::processEvents (this=this@entry=0x7fffffffd930, flags=...) at kernel/qeventloop.cpp:149 #25 0x00007ffff5c473a5 in QEventLoop::exec (this=this@entry=0x7fffffffd930, flags=...) at kernel/qeventloop.cpp:204 #26 0x00007ffff5c4cb79 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1225 #27 0x00007ffff617837c in QApplication::exec () at kernel/qapplication.cpp:3828 #28 0x0000000000402d18 in main (argc=<optimized out>, argv=<optimized out>) at ../../kmail/main.cpp:146 "" But it seems that exception was caught. However the next one wasn't caught: "" #0 0x00007ffff5825a30 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #1 0x00007ffff5877357 in std::__throw_logic_error(char const*) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #2 0x00007ffff5882b61 in char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #3 0x00007ffff5882ef8 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #4 0x00007fffea95dd00 in Baloo::PIM::EmailQuery::exec() () from /usr/lib/libbaloopim.so.4 #5 0x00007ffff112a3e6 in MessageList::Core::Filter::setSearchString (this=0x1e021d0, search=..., options=...) at ../../messagelist/core/filter.cpp:122 #6 0x00007ffff116ece9 in MessageList::Core::Widget::searchTimerFired (this=0xbce250) at ../../messagelist/core/widgetbase.cpp:989 #7 0x00007ffff5c5c87a in QMetaObject::activate (sender=0x1dec6c0, m=<optimized out>, local_signal_index=<optimized out>, argv=0x0) at kernel/qobject.cpp:3539 #8 0x00007ffff5c60a31 in QObject::event (this=0x1dec6c0, e=<optimized out>) at kernel/qobject.cpp:1156 #9 0x00007ffff6179e2c in QApplicationPrivate::notify_helper (this=this@entry=0x6c20f0, receiver=receiver@entry=0x1dec6c0, e=e@entry=0x7fffffffd6c0) at kernel/qapplication.cpp:4567 #10 0x00007ffff61804a0 in QApplication::notify (this=this@entry=0x7fffffffdce0, receiver=receiver@entry=0x1dec6c0, e=e@entry=0x7fffffffd6c0) at kernel/qapplication.cpp:4353 #11 0x00007ffff79b4baa in KApplication::notify (this=0x7fffffffdce0, receiver=0x1dec6c0, event=0x7fffffffd6c0) at ../../kdeui/kernel/kapplication.cpp:311 #12 0x00007ffff5c484dd in QCoreApplication::notifyInternal (this=0x7fffffffdce0, receiver=0x1dec6c0, event=0x7fffffffd6c0) at kernel/qcoreapplication.cpp:953 #13 0x00007ffff5c78323 in sendEvent (event=<optimized out>, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231 #14 QTimerInfoList::activateTimers (this=0x6b9f40) at kernel/qeventdispatcher_unix.cpp:621 #15 0x00007ffff5c75629 in timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:193 #16 idleTimerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:240 #17 0x00007fffed369e04 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #18 0x00007fffed36a048 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #19 0x00007fffed36a0ec in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0 #20 0x00007ffff5c757a1 in QEventDispatcherGlib::processEvents (this=0x607b20, flags=...) at kernel/qeventdispatcher_glib.cpp:434 #21 0x00007ffff621bbb6 in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204 #22 0x00007ffff5c470af in QEventLoop::processEvents (this=this@entry=0x7fffffffd930, flags=...) at kernel/qeventloop.cpp:149 #23 0x00007ffff5c473a5 in QEventLoop::exec (this=this@entry=0x7fffffffd930, flags=...) at kernel/qeventloop.cpp:204 #24 0x00007ffff5c4cb79 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1225 #25 0x00007ffff617837c in QApplication::exec () at kernel/qapplication.cpp:3828 #26 0x0000000000402d18 in main (argc=<optimized out>, argv=<optimized out>) at ../../kmail/main.cpp:146 "" Reproducible: Always Steps to Reproduce: 1. Start kmail 2. Select a folder with emails 3. Begin typing in the quick search field Actual Results: A crash is observed Expected Results: I think kmail2 (or baloo) should gracefully handle the situation where the database doesn't exist and most certainly not crash. BTW, how do I create the database? :)
BTW, contents of ~/.local/share/baloo/email: total 118068 -rw-r--r-- 1 shausman shausman 0 May 21 08:37 flintlock -rw-r--r-- 1 shausman shausman 28 Apr 22 15:17 iamchert -rw-rw-r-- 1 shausman shausman 0 Apr 23 09:39 postlist.baseA -rw-rw-r-- 1 shausman shausman 0 Apr 23 09:39 postlist.baseB -rw-r--r-- 1 shausman shausman 53772288 Apr 23 09:39 postlist.DB -rw-rw-r-- 1 shausman shausman 0 Apr 23 09:39 record.baseB -rw-r--r-- 1 shausman shausman 8732672 Apr 23 09:39 record.DB -rw-rw-r-- 1 shausman shausman 0 Apr 23 09:39 termlist.baseB -rw-r--r-- 1 shausman shausman 58392576 Apr 23 09:39 termlist.DB
Ok I think that I found pb I will send a fix soon.
finally we fixed it in 4.13.1 see: const QString dir = KGlobal::dirs()->localxdgdatadir() + "baloo/email/"; Xapian::Database db; try { db = Xapian::Database(QFile::encodeName(dir).constData()); } catch (const Xapian::DatabaseError& e) { kWarning() << "Failed to open Xapian database:" << QString::fromStdString(e.get_error_string()); return ResultIterator(); } => we catch error. It's in baloo.
Are you sure it's fixed? It seems commit 4d34a8286295d1eef2be24959fc51249b4322ec1 in baloo introduced this, but git tag --contains=4d34a8286295d1eef2be24959fc51249b4322ec1 suggests that fix is also in 4.13.0, which I'm running. Indeed that exception is caught and I can see the output of it. But we still get a crash later (see the second throw!)
This code fixed this type of crash. I will investigate it. I reopen it for the moment
I'm sorry, I wish I had a line number for the second throw :( Any idea how to re-create the baloo database, btw?
akonadictl stop rm -rf .kde/share/config/baloorc akondictl start :)
Ok, I've deleted the existing database files in the baloo/email/ folder, restarted akonadi, waited until it indexed all my huge folders and now kmail doesn't crash anymore neither. Perhaps the database was corrupt or incomplete before that? I understand that this might be difficult to reproduce at your end, so feel free to close this bug again.
I caught some other exceptions in baloo when we create database or access to it I hope that it fixes your crash (but I can't reproduce). It's in 4.13.3
I close it. Reopen if necessary in 4.13.3