Bug 365800

Summary: Since I moved to Kubuntu 16.04, kaddressbook crashes.
Product: [Applications] kaddressbook Reporter: Hans-Peter Guggenbichler <hanspeterg>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED DUPLICATE    
Severity: normal CC: ilpo, kdenis, tokoe
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Kubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Hans-Peter Guggenbichler 2016-07-18 07:33:18 UTC
Since 16.04 kaddressbook crashes on startup. I tried to remove ~/.local/share/contacts but kadr. is still crashing - so nothing to do with my data. Sent a crash report every time it crashed, but haven't been contacted yet. 

When started from command line, this is what is says:

hp@hp:~/.local/share/contacts$ kaddressbook 
()
""
connectToServer "/tmp/akonadi-hp.abH7hD/akonadiserver.socket"
"/subscriber/kaddressbook_31909_8pWTHp"
connectToServer "/tmp/akonadi-hp.abH7hD/akonadiserver.socket"
"/subscriber/kaddressbook_31909_O2bhpK"
connectToServer "/tmp/akonadi-hp.abH7hD/akonadiserver.socket"
"/subscriber/kaddressbook_31909_WGLoqv"
connectToServer "/tmp/akonadi-hp.abH7hD/akonadiserver.socket"
"KAddressBook::GlobalContactSession"
connectToServer "/tmp/akonadi-hp.abH7hD/akonadiserver.socket"
"/subscriber/kaddressbook_31909_sPlPub"
connectToServer "/tmp/akonadi-hp.abH7hD/akonadiserver.socket"
done
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
org.kde.akonadi.ETM: GEN true false true
org.kde.akonadi.ETM: collection: QVector()
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = kaddressbook path = /usr/bin pid = 31909
KCrash: Arguments: /usr/bin/kaddressbook 
KCrash: Attempting to start /usr/lib/i386-linux-gnu/libexec/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__0

[1]+  Stopped                 kaddressbook
hp@hp:~/.local/share/contacts$ QSocketNotifier: Invalid socket 17 and type 'Read', disabling...
QSocketNotifier: Invalid socket 15 and type 'Read', disabling...
QSocketNotifier: Invalid socket 19 and type 'Read', disabling...
QSocketNotifier: Invalid socket 25 and type 'Read', disabling...
QSocketNotifier: Invalid socket 13 and type 'Read', disabling...
QSocketNotifier: Invalid socket 27 and type 'Read', disabling...


Reproducible: Always

Steps to Reproduce:
start it up 

Actual Results:  
crash

Expected Results:  
crash not
Comment 1 Ilpo Kantonen 2016-09-03 17:01:38 UTC
I am using Asus core duo processor 2.0 GHz and upgraded Kubuntu 16.04.1 from 14.10. When I choose addressbook from kontact or start it typing kaddressbook in konsole, it crashes immediately. Here is log from konsole:

-----8X-----8X-----


$ kaddressbook
()
""
connectToServer "/tmp/akonadi-userme.1KdnWS/akonadiserver.socket"
"/subscriber/kaddressbook_4308_Kf75NF"
connectToServer "/tmp/akonadi-userme.1KdnWS/akonadiserver.socket"
"/subscriber/kaddressbook_4308_FmyhGu"
connectToServer "/tmp/akonadi-userme.1KdnWS/akonadiserver.socket"
"/subscriber/kaddressbook_4308_BUSlPv"
connectToServer "/tmp/akonadi-userme.1KdnWS/akonadiserver.socket"
KTranscript: Loaded property map: /usr/share/locale/fi/LC_SCRIPTS/ki18n5/general.pmapc
KTranscript: Loaded module: /usr/share/locale/fi/LC_SCRIPTS/ki18n5/ki18n5.js
"Interpolation {$[gen %1]} in {$[gen %1] &asetukset...} failed: Non-string return value: undefined"
"Interpolation {$[gen %1]} in {$[gen %1] käyttö&ohj...} failed: Non-string return value: undefined"
"Interpolation {$[elat %1]} in {&Tietoa $[yleisnimi_...} failed: Non-string return value: undefined"
"KAddressBook::GlobalContactSession"
connectToServer "/tmp/akonadi-userme.1KdnWS/akonadiserver.socket"
"/subscriber/kaddressbook_4308_E02TAo"
connectToServer "/tmp/akonadi-userme.1KdnWS/akonadiserver.socket"
done
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
org.kde.akonadi.ETM: GEN true false true
org.kde.akonadi.ETM: collection: QVector()
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = kaddressbook path = /usr/bin pid = 4308
KCrash: Arguments: /usr/bin/kaddressbook 
KCrash: Attempting to start /usr/lib/i386-linux-gnu/libexec/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__0
QSocketNotifier: Invalid socket 24 and type 'Read', disabling...
                                                                                                                                                                                     
[1]+  Pysäytetty             kaddressbook                                                                                                                                            
userme@usermew:~$ QSocketNotifier: Invalid socket 10 and type 'Read', disabling...                                                                                                       
QSocketNotifier: Invalid socket 13 and type 'Read', disabling...                                                                                                                     
QSocketNotifier: Invalid socket 15 and type 'Read', disabling...                                                                                                                     
QSocketNotifier: Invalid socket 17 and type 'Read', disabling...                                                                                                                     
QSocketNotifier: Invalid socket 26 and type 'Read', disabling...
Comment 2 Ilpo Kantonen 2016-09-04 22:54:02 UTC
In my case I have upgraded Kubuntu 14.10 -> 16.04.1 if that has some role to this crash. The 14.10 is not LTS and maybe upgrading from it to 16.04.1 causes problems to Kaddressbook?
Comment 3 Ilpo Kantonen 2016-09-04 22:58:27 UTC
Kmail works fine with contacts. When I write a new email Kmail finds contacts from addressbook and don't crash.
Comment 4 Ilpo Kantonen 2016-09-04 23:50:31 UTC
The crash occurred also with Tasklist application when started from Kontact. Maybe same reason to crash?
Comment 5 Ilpo Kantonen 2016-09-05 17:15:54 UTC
Today came some updates to Kubuntu and now the crash message is (collections renamed):

$ kaddressbook
()
""
connectToServer "/tmp/akonadi-user.l8b2Q0/akonadiserver.socket"
"/subscriber/kaddressbook_13057_mkmdNf"
connectToServer "/tmp/akonadi-user.l8b2Q0/akonadiserver.socket"
"/subscriber/kaddressbook_13057_3Lga2L"
connectToServer "/tmp/akonadi-user.l8b2Q0/akonadiserver.socket"
"/subscriber/kaddressbook_13057_L3LhLW"
connectToServer "/tmp/akonadi-user.l8b2Q0/akonadiserver.socket"
KTranscript: Loaded property map: /usr/share/locale/fi/LC_SCRIPTS/ki18n5/general.pmapc
KTranscript: Loaded module: /usr/share/locale/fi/LC_SCRIPTS/ki18n5/ki18n5.js
"Interpolation {$[gen %1]} in {$[gen %1] &asetukset...} failed: Non-string return value: undefined"
"Interpolation {$[gen %1]} in {$[gen %1] käyttö&ohj...} failed: Non-string return value: undefined"
"Interpolation {$[elat %1]} in {&Tietoa $[yleisnimi_...} failed: Non-string return value: undefined"
"KAddressBook::GlobalContactSession"
connectToServer "/tmp/akonadi-user.l8b2Q0/akonadiserver.socket"
"/subscriber/kaddressbook_13057_pEx8bY"
connectToServer "/tmp/akonadi-user.l8b2Q0/akonadiserver.socket"
done
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
Connected to "Akonadi" , using protocol version 52
Server says: "Not Really IMAP server"
org.kde.akonadi.ETM: GEN true false true
org.kde.akonadi.ETM: collection: QVector()
org.kde.akonadi.ETM: Subtree:  10 QSet(91, 103, 96, 81, 92, 77, 76, 79, 10, 78)
org.kde.akonadi.ETM: collection: "C1"
org.kde.akonadi.ETM: collection: "C2"
org.kde.akonadi.ETM: collection: "C3"
org.kde.akonadi.ETM: collection: "C4"
org.kde.akonadi.ETM: collection: "C5"
org.kde.akonadi.ETM: collection: "C6"                                                                                                                                        
org.kde.akonadi.ETM: collection: "C7"                                                                                                                                             
org.kde.akonadi.ETM: collection: "C8"                                                                                                                                        
org.kde.akonadi.ETM: collection: "C9"                                                                                                                                 
org.kde.akonadi.ETM: collection: "C10"                                                                                                                                       
org.kde.akonadi.ETM: Fetch job took  423 msec                                                                                                                                        
org.kde.akonadi.ETM: was collection fetch job: collections: 10                                                                                                                       
org.kde.akonadi.ETM: first fetched collection: "C9"                                                                                                                   
KCrash: crashing... crashRecursionCounter = 2                                            <- look this line                                                                                            
KCrash: Application Name = kaddressbook path = /usr/bin pid = 13057                                                                                                                  
KCrash: Arguments: /usr/bin/kaddressbook                                                                                                                                             
KCrash: Attempting to start /usr/lib/i386-linux-gnu/libexec/drkonqi from kdeinit                                                                                                     
sock_file=/run/user/1000/kdeinit5__0                                                                                                                                                 
QSocketNotifier: Invalid socket 24 and type 'Read', disabling...                                                                                                                     
                                                                                                                                                                                     
[1]+  Stopped                kaddressbook                                                                                                                                            
user@usersmachine:~$ QSocketNotifier: Invalid socket 13 and type 'Read', disabling...                                                                                                       
QSocketNotifier: Invalid socket 17 and type 'Read', disabling...                                                                                                                     
QSocketNotifier: Invalid socket 15 and type 'Read', disabling...                                                                                                                     
QSocketNotifier: Invalid socket 26 and type 'Read', disabling...                                                                                                                     
QSocketNotifier: Invalid socket 10 and type 'Read', disabling...
Comment 6 Hans-Peter Guggenbichler 2016-10-10 06:11:05 UTC
I'm on 16.10 and it is still there.
Comment 7 Hans-Peter Guggenbichler 2016-10-14 19:23:02 UTC
On some forums (I don't remember on which ones) I read, that this is related to contacts with a birthday field.
So I tried this:
1)    backup all contacts from ~/.local/share/contacts 
       remove all contacts from contacts directory  (~/.local/share/contacts)
       stop akonadi
       remove all akonadi related files
       start akonadi
       Result: kaddressbook starts, is usable, is empty, of course
2)  add some contacts to the contacts dir.
      ensure that there is no BDAY field in any of them
       stop akonadi
       remove all akonadi related files
       start akonadi
       Result: kaddressbook starts, is usable !

3) add all the other contacts to contacts dir. Now there are many of them with a BDAY field.
      stop akonadi
       remove all akonadi related files
       start akonadi
       Result: kaddressbook starts, is usable !?!?!?!?

I don't know why, but now it is working.
Comment 8 Ilpo Kantonen 2016-10-16 03:06:18 UTC
I did it. First backuped .local/share/contacts and then removed them. Then I stopped akonadi. Then I added one vcf file to contacts. And then I started Kmail. All emails were disappeared and the directory structure in Kmail! Fortunately I got emails back restarting machine.

How you remove all akonadi related files?
Comment 9 Hans-Peter Guggenbichler 2016-10-17 07:26:52 UTC
I did this: 

rm -r ~/.local/share/akonadi
rm -r ~/.config/akonadi
rm -r ~/.kde/share/apps/nepomuk
rm -r ~/.kde/share/apps/akonadi_nepomuk_feeder

rm -r ~/.kde/share/config/nepomuk*
rm -r ~/.kde/share/config/akona*

I don't know, if this still is the correct way to do it, because I worked this out a few months (years??) ago. But it did the job this time. If you want to be shure to hit all the akonadi related stuff, just do a find in your home directory for akonadi. 
Akonadi stores info about your emails, mainboxes, contacts, ... in its own databases. By removing these databases you don't remove your emails, contacts, ... Thats why you emails disappeared in kmail. akonadi first had to crawl your file system and search for all the information and build its database. Once this jas finished, your emails reappeared in kmail.
When I wiped akonadi, I recognized, that some config got lost, unfortunately. So I had to use akonadiconsole to restart the Birthday agent, the Local Contacts agent. And I had to reconfig the pop3 account in kmail.  So you have to have a close look at your system after removing the akonadi files. Until now, I've lost no information afer removing akonadi, fingers crossed.
Comment 10 Ilpo Kantonen 2016-10-17 19:38:22 UTC
I runned kaddressbook in gdb. I use binary Kubuntu 16.04.1 and gdb don't help very much but this maybe helps little to find the bug. The bug can be in isValid function?

(gdb) bt
#0  0xb5b06096 in Akonadi::Tag::isValid() const () from /usr/lib/i386-linux-gnu/libKF5AkonadiCore.so.5
#1  0xb5ba3a04 in Akonadi::TagModel::data(QModelIndex const&, int) const () from /usr/lib/i386-linux-gnu/libKF5AkonadiCore.so.5
#2  0xb7eea335 in ?? () from /usr/lib/i386-linux-gnu/libkaddressbookprivate.so.5
#3  0xb7eebb55 in ?? () from /usr/lib/i386-linux-gnu/libkaddressbookprivate.so.5
#4  0xb6b6d230 in QtPrivate::QSlotObjectBase::call (a=0xbfffe5ac, r=0x819e0b8, this=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qobject_impl.h:124
#5  QMetaObject::activate (sender=0x81c2090, signalOffset=3, local_signal_index=10, argv=0xbfffe5ac) at kernel/qobject.cpp:3698
#6  0xb6b6db0d in QMetaObject::activate (sender=0x81c2090, m=0xb6da9018 <QAbstractItemModel::staticMetaObject>, local_signal_index=10, argv=0xbfffe5ac) at kernel/qobject.cpp:3578
#7  0xb6beca31 in QAbstractItemModel::rowsInserted (this=0x81c2090, _t1=..., _t2=0, _t3=0) at .moc/moc_qabstractitemmodel.cpp:583
#8  0xb6ae458e in QAbstractItemModel::endInsertRows (this=0x81c2090) at itemmodels/qabstractitemmodel.cpp:2619
#9  0xb5ba59ed in ?? () from /usr/lib/i386-linux-gnu/libKF5AkonadiCore.so.5
#10 0xb5ba6182 in ?? () from /usr/lib/i386-linux-gnu/libKF5AkonadiCore.so.5
#11 0xb5ba2fbe in ?? () from /usr/lib/i386-linux-gnu/libKF5AkonadiCore.so.5
#12 0xb6b6d611 in QMetaObject::activate (sender=0x81d5760, signalOffset=22, local_signal_index=0, argv=0xbfffe864) at kernel/qobject.cpp:3713
#13 0xb6b6db0d in QMetaObject::activate (sender=0x81d5760, m=0xb5c293f4 <Akonadi::TagFetchJob::staticMetaObject>, local_signal_index=0, argv=0xbfffe864) at kernel/qobject.cpp:3578
#14 0xb5b52f91 in Akonadi::TagFetchJob::tagsReceived(QVector<Akonadi::Tag> const&) () from /usr/lib/i386-linux-gnu/libKF5AkonadiCore.so.5
#15 0xb5b54afd in ?? () from /usr/lib/i386-linux-gnu/libKF5AkonadiCore.so.5
#16 0xb5b3c0c6 in ?? () from /usr/lib/i386-linux-gnu/libKF5AkonadiCore.so.5
#17 0xb6b6a420 in QMetaCallEvent::placeMetaCall (this=0x80d7ca8, object=0x81d5760) at kernel/qobject.cpp:486
#18 0xb6b6e243 in QObject::event (this=0x81d5760, e=0x80d7ca8) at kernel/qobject.cpp:1239
#19 0xb742115a in QApplicationPrivate::notify_helper (this=0x8094260, receiver=0x81d5760, e=0x80d7ca8) at kernel/qapplication.cpp:3716
#20 0xb742681c in QApplication::notify (this=0xbfffef08, receiver=0x81d5760, e=0x80d7ca8) at kernel/qapplication.cpp:3499
#21 0xb6b3d81f in QCoreApplication::notifyInternal (this=0xbfffef08, receiver=0x81d5760, event=0x80d7ca8) at kernel/qcoreapplication.cpp:965
#22 0xb6b3feff in QCoreApplication::sendEvent (event=0x80d7ca8, receiver=<optimized out>) at kernel/qcoreapplication.h:224
#23 QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x80928a8) at kernel/qcoreapplication.cpp:1593
#24 0xb6b403e7 in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1451
#25 0xb6b95703 in postEventSourceDispatch (s=0x80c51e0) at kernel/qeventdispatcher_glib.cpp:271
#26 0xb4ca7ed9 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0
#27 0xb4ca8179 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0
#28 0xb4ca8244 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0
#29 0xb6b95af3 in QEventDispatcherGlib::processEvents (this=0x80c3188, flags=...) at kernel/qeventdispatcher_glib.cpp:418
#30 0xab924a81 in QPAEventDispatcherGlib::processEvents (this=0x80c3188, flags=...) at eventdispatchers/qeventdispatcher_glib.cpp:115
#31 0xb6b3a953 in QEventLoop::processEvents (this=0xbfffee48, flags=...) at kernel/qeventloop.cpp:128
#32 0xb6b3adaa in QEventLoop::exec (this=0xbfffee48, flags=...) at kernel/qeventloop.cpp:204
#33 0xb6b43385 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1229
#34 0xb6e62931 in QGuiApplication::exec () at kernel/qguiapplication.cpp:1542
#35 0xb741d024 in QApplication::exec () at kernel/qapplication.cpp:2976
#36 0x0804cdaf in main ()
Comment 11 Ilpo Kantonen 2016-10-17 20:53:43 UTC
I checked my contacts with Vcard validator
https://l0b0.wordpress.com/2009/12/25/vcard-parser-and-validator/

For example there were errors like this:
Mandatory property missing (See RFC 2426 section 5 for details): FN  <- very often occurred
Invalid date (See RFC 2425 section 5.8.4 for date syntax)

I think that the errors are from contacts which are added long time since this day. Maybe there are some format modifications, which old data doesn't fit?

Thus I think KDE should follow the standards.
Comment 12 Ilpo Kantonen 2016-10-18 17:15:10 UTC
Now I logged out from my account and then I logged in non graphical. Then I removed all ~/.local/share/clontacts/ files and logged again in graphical mode. The kaddressbook crashed even with empty contacts.

I think that the bug is in Akonadi and it can't handle old vcard files properly.
Comment 13 Ilpo Kantonen 2016-10-19 17:12:56 UTC
https://github.com/KDE/akonadi/blob/master/src/core/tag.cpp

Line 239, in Tag::isValid() function:

return d_ptr->id >= 0;

Has d_ptr in some situation unset value? And then Segment fault...
Comment 14 Ilpo Kantonen 2016-10-20 14:44:28 UTC
When I start akonadiconsole, and then Browse-button:

KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = akonadiconsole path = /usr/bin pid = 27742
KCrash: Arguments: /usr/bin/akonadiconsole 
KCrash: Attempting to start /usr/lib/i386-linux-gnu/libexec/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__0
Comment 15 Denis Kurz 2017-01-17 11:16:11 UTC

*** This bug has been marked as a duplicate of bug 365944 ***