Bug 358696

Summary: KF5's kaddressbook crashes when adding a contact that has a birthday
Product: [Frameworks and Libraries] Akonadi Reporter: eric <prozac>
Component: Birthdays ResourceAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED WORKSFORME    
Severity: major CC: hanspeterg, montel, prozac
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 5.2.2
Sentry Crash Report:
Attachments: Trace of addressbook right after adding a contact with a birthday.
Backtrace of kaddressbook crash
Backtrace of kaddressbook after adding contact with birthday
Backtrace of korganizer when trying to create new event
Backtrace of kaddressbook after applying patch in comment 13

Description eric 2016-01-28 18:58:38 UTC
When adding/importing a contact that has a birthday, kaddressbook will crash immediately and the next times it is started.
This is with Framework-5.18, Akonadi-15.12.1 and Kaddressbook-15.12.1.

Reproducible: Always

Steps to Reproduce:
1. Do 'rm -rf akonadi*' in ~/.kde4, ~/.local/share and ~/.config (or create new user)
2. Let akonadi create a new database
3. Start kaddressbook and create a new contact with a birthday

Actual Results:  
Kaddressbook will immediately crash after the contact is created and it will crash the next times it is started.

Expected Results:  
No crash.

This crash only happens when the "Birthdays and Anniversaries" calendar is enabled. This can be checked in korganizer.

Without this calendar, kaddressbook will not crash when adding a new contact with a birthday... but it will start crashing when this calendar is enabled later (for example when "Birthdays and Anniversaries" is added as a new calendar in korganizer).
Comment 1 Laurent Montel 2016-01-28 19:20:00 UTC
Backtrace please
Comment 2 eric 2016-02-21 17:22:07 UTC
This still happens with KF-5.19.0 and akonadi/korganizer/kaddressbook-15.12.2.

Kaddressbook will crash after creating/importing a contact with a birthday and/or anniversary, when contact has no birthday or anniversary no crash will happen.

After this crash kaddressbook and korganizer are not usable anymore, because kaddressbook will always crash when started, and korganizer will crash when selecting the to-do or event view or when adding a new to-do or event. Korganizer is only usable when it is only used for viewing the monthly/weekly/daily calendar.

This all is tested on a completely empty (newly created) home directory and also tested with both the MySQL (MariaDB) and SQLite3 database engines.

Other information:
Qt-5.5.1, Glibc-2.22, the system is 32bits and the filesystem is BtrFS with zlib compression.

The backtrace is said to be unusable, but I'll attach anyway.
Comment 3 eric 2016-02-21 17:27:02 UTC
Created attachment 97344 [details]
Trace of addressbook right after adding a contact with a birthday.
Comment 4 eric 2016-04-20 16:50:47 UTC
Created attachment 98479 [details]
Backtrace of kaddressbook crash

This crash still happen with:
- KDE Framework 5.21.0
- KDE Applications 15.12.3
- KDE Plasma 5.6.3
- Qt 5.6.0
- Linux 4.5.1 32bit (is 32bit the problem? Maybe the devs are using 64bit computers)

There is some improvement:
In the past, adding a contact with a birthday in kaddressbook used to crash kaddressbook and korganizer's to-do and even view, but now korganizer's event view does not crash anymore.

This is the last thing I see in the console when kaddressbook/korganizer crash:
ASSERT failure in QVector<T>::at: "index out of range", file /usr/include/qt/QtCore/qvector.h, line 419
Comment 5 Laurent Montel 2016-04-21 05:39:41 UTC
could you try to add birthday resource ?
I tried to make it crash but not success yet
Comment 6 eric 2016-04-25 16:23:42 UTC
The birthday resource is already added on a newly created homedir of a test user. I always do a 'rm -rf /home/testuser /tmp/akonadi-testuser*' before login as testuser and testing kaddressbook.

Adding a contact with a birthday crashes kaddressbook when there is a birthday resource.
After this crash:
- kaddressbook will crash immediately after start;
- korganizer will crash when showing the to-do view or creating new event or to-do;
- korganizer will not crash in the calendar view, the birthday of the new contact is visible;
- akonadiconsole will crash when choosing the browser tab;
- configuring the birthday resource in akonadiconsole will crash the configure dialog

But no crash will happen when I remove the birthday resource first before adding a contact with a birthday... of course this way I will not be able to see the birthday in korganizer's calendar view.
Comment 7 eric 2016-04-25 16:27:25 UTC
I forgot to say that I'm now using KDE-applications 16.04.0 and still having this problem.
Comment 8 eric 2016-05-29 16:44:53 UTC
Tested this again after a big upgrade and still the same behaviour.
This time: KDE-applications 16.04.1, KDE-frameworks 5.22.0 and KDE-plasma 5.6.4.

The output just before the crash:
org.kde.akonadi.ETM: GEN true false true
org.kde.akonadi.ETM: collection: QVector()
Segmentation fault (core dumped)
Comment 9 Laurent Montel 2016-05-29 18:54:53 UTC
Could you add debug package to add more info ?
Comment 10 eric 2016-05-31 00:42:23 UTC
Created attachment 99278 [details]
Backtrace of kaddressbook after adding contact with birthday
Comment 11 eric 2016-05-31 00:44:47 UTC
Created attachment 99279 [details]
Backtrace of korganizer when trying to create new event
Comment 12 eric 2016-05-31 01:02:32 UTC
I've added 2 new attachments made after I've compiled akonadi and kdepim with debugging info turned on. I've never done this before, so tell me if there is something I should do.

I still see some ?? in the backtrace... those are related to Qt libraries. Tell me if you also need those for debugging.

This is how I have tested:
1) Create a new homedir of the user "test" (rm -rf /tmp/test && sudo -u test mkdir /tmp/test);
2) Log in to KDE as user "test";
3) Start konsole;
4) Start kaddressbook from konsole;
5) Create a new contact with a birthday, this will result in a crash;
6) Start korganizer from konsole;
7) Create a new event, this will result in a crash;
Comment 13 Laurent Montel 2016-05-31 05:42:42 UTC
Git commit c51da6e79efa54850a676b0e6367f8cfda407351 by Montel Laurent.
Committed on 31/05/2016 at 05:26.
Pushed by mlaurent into branch 'Applications/16.04'.

Fix Bug 358696 - KF5's kaddressbook crashes when adding a contact that has a birthday

FIXED-IN: 5.2.2

M  +3    -0    src/core/models/tagmodel.cpp

http://commits.kde.org/akonadi/c51da6e79efa54850a676b0e6367f8cfda407351
Comment 14 Laurent Montel 2016-05-31 05:47:31 UTC
I can't validate that it will not crash for you but this code avoid a potential crash.
Reopen if it still crashs please
Comment 15 eric 2016-05-31 20:28:47 UTC
Created attachment 99291 [details]
Backtrace of kaddressbook after applying patch in comment 13

I've patched akonadi using the diff in the commit you linked to in comment 13 and recompiled.

It still crashes. I've attached the backtrace of this crash.
The output on konsole between start and crash:

Recreating ksycoca file ("/tmp/test/.cache/ksycoca5_C_3hIv+tPrC1WaYX0kkAsoimmSnJQ=", version 303)                                                                                                         
Menu "applications-kmenuedit.menu" not found.                                                                                                                                                             
Saving                                                                                                                                                                                                    
ATTENTION: default value of option vblank_mode overridden by environment.                                                                                                                                 
org.kde.akonadi.ETM: GEN true false true                                                                                                                                                                  
org.kde.akonadi.ETM: collection: QVector()                                                                                                                                                                
org.kde.akonadi.ETM: Subtree:  7 QSet(7)                                                                                                                                                                  
org.kde.akonadi.ETM: collection: "Personal Contacts"                                                                                                                                                      
org.kde.akonadi.ETM: Fetch job took  187 msec                                                                                                                                                             
org.kde.akonadi.ETM: was collection fetch job: collections: 1                                                                                                                                             
org.kde.akonadi.ETM: first fetched collection: "Personal Contacts"                                                                                                                                        
org.kde.akonadi.ETM: Fetch job took  35 msec                                                                                                                                                              
org.kde.akonadi.ETM: was item fetch job: items: 0                                                                                                                                                         
org.kde.akonadi.ETM: GEN true false true                                                                                                                                                                  
org.kde.akonadi.ETM: collection: QVector()                                                                                                                                                                
org.kde.akonadi.ETM: Subtree:  7 QSet(7)                                                                                                                                                                  
org.kde.akonadi.ETM: Fetch job took  359 msec                                                                                                                                                             
org.kde.akonadi.ETM: was collection fetch job: collections: 1                                                                                                                                             
org.kde.akonadi.ETM: first fetched collection: "Personal Contacts"                                                                                                                                        
KCrash: Application 'kaddressbook' crashing...                                                                                                                                                            
KCrash: Attempting to start /usr/lib/drkonqi from kdeinit                                                                                                                                                 
QSocketNotifier: Invalid socket 43 and type 'Read', disabling...                                                                                                                                          
QSocketNotifier: Invalid socket 9 and type 'Read', disabling...                                                                                                                                           
QSocketNotifier: Invalid socket 13 and type 'Read', disabling...                                                                                                                                          
QSocketNotifier: Invalid socket 21 and type 'Read', disabling...                                                                                                                                          
QSocketNotifier: Invalid socket 19 and type 'Read', disabling...
QSocketNotifier: Invalid socket 26 and type 'Read', disabling...
QSocketNotifier: Invalid socket 31 and type 'Read', disabling...
QSocketNotifier: Invalid socket 33 and type 'Read', disabling...
Comment 16 eric 2016-06-20 13:41:41 UTC
Can someone test if this issue only happens on a 32bit system?
I have two systems, both are 32bit and both have this issue.
One other person also has a 32bit system and also has this issue.
Comment 17 Hans-Peter Guggenbichler 2016-10-10 07:01:40 UTC
I'm on a 32 bit system and I have exactly the same behaviour.
Comment 18 Justin Zobel 2022-10-26 03:06:59 UTC
Thank you for reporting this bug in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 19 Bug Janitor Service 2022-11-10 05:11:57 UTC
Dear Bug Submitter,

This bug has been in NEEDSINFO status with no change for at least
15 days. Please provide the requested information as soon as
possible and set the bug status as REPORTED. Due to regular bug
tracker maintenance, if the bug is still in NEEDSINFO status with
no change in 30 days the bug will be closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

If you have already provided the requested information, please
mark the bug as REPORTED so that the KDE team knows that the bug is
ready to be confirmed.

Thank you for helping us make KDE software even better for everyone!
Comment 20 Bug Janitor Service 2022-11-25 05:22:13 UTC
This bug has been in NEEDSINFO status with no change for at least
30 days. The bug is now closed as RESOLVED > WORKSFORME
due to lack of needed information.

For more information about our bug triaging procedures please read the
wiki located here:
https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging

Thank you for helping us make KDE software even better for everyone!