Bug 325975

Summary: Contact List crashed after I merged 2 roster items twice
Product: [Unmaintained] telepathy Reporter: Dennis Schridde <heri+kde>
Component: contactlistAssignee: Telepathy Bugs <kde-telepathy-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: heri+kde, kde, leonh, mklapetek
Priority: NOR Keywords: drkonqi
Version: 0.6.80   
Target Milestone: Future   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: New crash information added by DrKonqi
New crash information added by DrKonqi

Description Dennis Schridde 2013-10-13 17:30:37 UTC
Application: ktp-contactlist (0.6.80)
KDE Platform Version: 4.11.2
Qt Version: 4.8.5
Operating System: Linux 3.11.4-gentoo x86_64
Distribution: "Gentoo Base System release 2.2"

-- Information about the crash:
- What I was doing when the application crashed:

I marked 2 items in my roster, and then clicked "merge" - twice. Afterwards, I had the meta contact displayed twice in the Contact List. When I closed the window, it crashed.

-- Backtrace:
Application: KDE-Telepathy-Kontaktliste (ktp-contactlist), signal: Segmentation fault
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f8cd507d780 (LWP 2981))]

Thread 3 (Thread 0x7f8ccec16700 (LWP 2988)):
#0  0x0000003a040de2dd in poll () from /lib64/libc.so.6
#1  0x0000003f7a0489c4 in ?? () from /usr/lib64/libglib-2.0.so.0
#2  0x0000003f7a048ad4 in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#3  0x00007f8ccc7d0bed in ?? () from /usr/lib64/gio/modules/libdconfsettings.so
#4  0x0000003f7a06ca65 in ?? () from /usr/lib64/libglib-2.0.so.0
#5  0x0000003a04807dff in start_thread () from /lib64/libpthread.so.0
#6  0x0000003a040e701d in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f8cc7fff700 (LWP 2989)):
#0  0x0000003a040f3662 in __libc_disable_asynccancel () from /lib64/libc.so.6
#1  0x0000003a040de2e9 in poll () from /lib64/libc.so.6
#2  0x0000003f7a0489c4 in ?? () from /usr/lib64/libglib-2.0.so.0
#3  0x0000003f7a048e4a in g_main_loop_run () from /usr/lib64/libglib-2.0.so.0
#4  0x0000003f800ced66 in ?? () from /usr/lib64/libgio-2.0.so.0
#5  0x0000003f7a06ca65 in ?? () from /usr/lib64/libglib-2.0.so.0
#6  0x0000003a04807dff in start_thread () from /lib64/libpthread.so.0
#7  0x0000003a040e701d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f8cd507d780 (LWP 2981)):
[KCrash Handler]
#6  QStandardItemPrivate::setModel (this=<optimized out>, mod=mod@entry=0x0) at itemviews/qstandarditemmodel.cpp:302
#7  0x00000036a915d464 in QStandardItemPrivate::~QStandardItemPrivate (this=0x1ab5140, __in_chrg=<optimized out>) at itemviews/qstandarditemmodel.cpp:96
#8  0x00000036a915d5a9 in QStandardItemPrivate::~QStandardItemPrivate (this=0x1ab5140, __in_chrg=<optimized out>) at itemviews/qstandarditemmodel.cpp:102
#9  0x00000036a915a5c1 in cleanup (pointer=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:62
#10 ~QScopedPointer (this=0x1aa3438, __in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:100
#11 QStandardItem::~QStandardItem (this=0x1aa3430, __in_chrg=<optimized out>) at itemviews/qstandarditemmodel.cpp:778
#12 0x00000036a915a619 in QStandardItem::~QStandardItem (this=0x1aa3430, __in_chrg=<optimized out>) at itemviews/qstandarditemmodel.cpp:780
#13 0x00000036a915c389 in cleanup (pointer=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:62
#14 ~QScopedPointer (this=0x1a8d548, __in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:100
#15 QStandardItemModelPrivate::~QStandardItemModelPrivate (this=0x1a8d480, __in_chrg=<optimized out>) at itemviews/qstandarditemmodel.cpp:330
#16 0x00000036a915c649 in QStandardItemModelPrivate::~QStandardItemModelPrivate (this=0x1a8d480, __in_chrg=<optimized out>) at itemviews/qstandarditemmodel.cpp:335
#17 0x0000003289595e95 in cleanup (pointer=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:62
#18 ~QScopedPointer (this=0x1a869d8, __in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:100
#19 QObject::~QObject (this=0x1a869d0, __in_chrg=<optimized out>) at kernel/qobject.cpp:816
#20 0x00000032895716ad in QAbstractItemModel::~QAbstractItemModel (this=0x1a869d0, __in_chrg=<optimized out>) at kernel/qabstractitemmodel.cpp:1389
#21 0x00000036ac414ff9 in KPeople::PersonsModel::~PersonsModel() () from /usr/lib64/libkpeople.so.1
#22 0x0000003289593857 in QObjectPrivate::deleteChildren (this=this@entry=0x1a96a60) at kernel/qobject.cpp:1907
#23 0x0000003289595e5f in QObject::~QObject (this=0x1a96a30, __in_chrg=<optimized out>) at kernel/qobject.cpp:926
#24 0x00000032895716ad in QAbstractItemModel::~QAbstractItemModel (this=0x1a96a30, __in_chrg=<optimized out>) at kernel/qabstractitemmodel.cpp:1389
#25 0x00000036a9150120 in QSortFilterProxyModel::~QSortFilterProxyModel (this=0x1a96a30, __in_chrg=<optimized out>) at itemviews/qsortfilterproxymodel.cpp:1547
#26 0x00000036ad827039 in KTp::ContactsModel::~ContactsModel() () from /usr/lib64/libktpmodelsprivate.so.6
#27 0x0000003289593857 in QObjectPrivate::deleteChildren (this=this@entry=0x1a9e920) at kernel/qobject.cpp:1907
#28 0x00000036a8c191a6 in QWidget::~QWidget (this=0x1aa64e0, __in_chrg=<optimized out>) at kernel/qwidget.cpp:1679
#29 0x000000000041f769 in _start ()

The reporter indicates this bug may be a duplicate of or related to bug 325375.

Possible duplicates by query: bug 325375, bug 324794.

Reported using DrKonqi
Comment 1 David Edmundson 2013-10-14 09:03:45 UTC
*** Bug 325375 has been marked as a duplicate of this bug. ***
Comment 2 David Edmundson 2013-10-14 09:59:28 UTC
Can anyone reliably reproduce this?

#26 0x00000036ad827039 in KTp::ContactsModel::~ContactsModel() () from /usr/lib64/libktpmodelsprivate.so.6

doesn't seem like it has anything to do with merging contacts, but more like the application is exiting.
Comment 3 Dennis Schridde 2013-10-14 11:00:41 UTC
Created attachment 82841 [details]
New crash information added by DrKonqi

ktp-contactlist (0.6.80) on KDE Platform 4.11.2 using Qt 4.8.5

- What I was doing when the application crashed:

Reliably reproduced:
1) Select two roster items
2) Quickly click the green + merge button several times in a row
3) Close Contact List
4) Observe the segfault

-- Backtrace (Reduced):
#6  QStandardItemPrivate::setModel (this=<optimized out>, mod=mod@entry=0x0) at itemviews/qstandarditemmodel.cpp:302
#7  0x00000032d3f5d464 in QStandardItemPrivate::~QStandardItemPrivate (this=0x1f9a4c0, __in_chrg=<optimized out>) at itemviews/qstandarditemmodel.cpp:96
#8  0x00000032d3f5d5a9 in QStandardItemPrivate::~QStandardItemPrivate (this=0x1f9a4c0, __in_chrg=<optimized out>) at itemviews/qstandarditemmodel.cpp:102
#9  0x00000032d3f5a5c1 in cleanup (pointer=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:62
#10 ~QScopedPointer (this=0x1f8ce88, __in_chrg=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:100
Comment 4 David Edmundson 2013-10-14 11:01:54 UTC
Aha. I understand, I can reproduce this now too.

Thanks.
Comment 5 David Edmundson 2013-10-14 13:39:07 UTC
So we have a lovely race condition inside PersonsModel::createPersonFromUris(const QList<QUrl> &uris)

we should probably a make a queue of jobs and process them in turn - rather than all at once which is where it gets screwed up.

Or the slightly bodgier approach is to block the button from being enabled whilst a job is happening.

Martin, thoughts?
Comment 6 Martin Klapetek 2013-10-14 13:45:33 UTC
I'd go for disabling the button, but that depends on how fast the operation actually is. If it's fast enough, disabling it is imho ok as it makes no sense to try and merge the same thing plus it takes a bit of time to select another contacts, where in the meantime the previous job could be finished already. It also gives clear indication of "working".

Queuing would require some detection of already running identical jobs/queries and not running it again, even if for performance reasons. Maybe.
Comment 7 David Edmundson 2013-10-24 15:32:27 UTC
Git commit fd8207f0d8bdbab31c4908d31dfe57d7cf95a152 by David Edmundson.
Committed on 22/10/2013 at 17:31.
Pushed by davidedmundson into branch 'master'.

Make merge person job syncronous
REVIEW: 113407

M  +13   -0    src/personsmodel.cpp

http://commits.kde.org/libkpeople/fd8207f0d8bdbab31c4908d31dfe57d7cf95a152
Comment 8 David Edmundson 2013-10-25 16:14:27 UTC
Git commit 0d6f4c57a1c0a21c52540cf60a9f170f3db91d11 by David Edmundson.
Committed on 22/10/2013 at 17:31.
Pushed by davidedmundson into tag 'v0.1.0'.

Make merge person job syncronous
REVIEW: 113407

M  +13   -0    src/personsmodel.cpp

http://commits.kde.org/libkpeople/0d6f4c57a1c0a21c52540cf60a9f170f3db91d11
Comment 9 David Edmundson 2013-10-25 16:15:16 UTC
Git commit 946580dacb950f53cb3d3386445992bcdb17307e by David Edmundson.
Committed on 22/10/2013 at 17:31.
Pushed by davidedmundson into branch 'libkpeople-0.1'.

Make merge person job syncronous
REVIEW: 113407

M  +13   -0    src/personsmodel.cpp

http://commits.kde.org/libkpeople/946580dacb950f53cb3d3386445992bcdb17307e
Comment 10 Dennis Schridde 2013-10-30 09:15:59 UTC
Created attachment 83220 [details]
New crash information added by DrKonqi

ktp-contactlist (0.7.0) on KDE Platform 4.11.2 using Qt 4.8.5

- What I was doing when the application crashed:
The issue is back in 0.7.0. Due to bug #326851 my contacts were doubled. I tried to resolve that by merging them. Upon close contactlist crashed.

- Unusual behavior I noticed:
See bug #326851 comment #2. After updating the Nepomuk ontology, all my contacts were doubled. There was one copy with a JID and one where contactlist did not show a JID. My guess is that the ontology update slowly converted the contacts, so they were added back to the contactlist not immediately. Apparently some incomplete and doubled information crept in.

-- Backtrace (Reduced):
#6  isEmpty (this=0x20) at ../../include/QtCore/../../src/corelib/tools/qvector.h:139
#7  QStandardItemPrivate::setModel (this=0x0, mod=mod@entry=0x0) at itemviews/qstandarditemmodel.cpp:293
#8  0x0000003d8d75d464 in QStandardItemPrivate::~QStandardItemPrivate (this=0x26129b0, __in_chrg=<optimized out>) at itemviews/qstandarditemmodel.cpp:96
#9  0x0000003d8d75d5a9 in QStandardItemPrivate::~QStandardItemPrivate (this=0x26129b0, __in_chrg=<optimized out>) at itemviews/qstandarditemmodel.cpp:102
#10 0x0000003d8d75a5c1 in cleanup (pointer=<optimized out>) at ../../include/QtCore/../../src/corelib/tools/qscopedpointer.h:62