Bug 325376

Summary: Nepomuk Telepathy Service crash when stopping
Product: [Unmaintained] telepathy Reporter: Daniele E. Domenichelli <ddomenichelli>
Component: nepomuk-serviceAssignee: Telepathy Bugs <kde-telepathy-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: kde, nepomuk-bugs
Priority: NOR Keywords: drkonqi
Version: unspecifiedFlags: kde: ReviewRequest+
Target Milestone: Future   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Daniele E. Domenichelli 2013-09-27 23:37:20 UTC
Application: nepomukservicestub (0.1.0)
KDE Platform Version: 4.10.5 (Compiled from sources)
Qt Version: 4.8.6
Operating System: Linux 3.10-3-amd64 x86_64
Distribution: Debian GNU/Linux testing (jessie)

-- Information about the crash:
- What I was doing when the application crashed:
When I stop nepomuk telepathy service through dbus (qdbus org.kde.NepomukServer /servicemanager org.kde.nepomuk.ServiceManager.stopService nepomuktelepathyservice) sometimes I get this crash

The crash can be reproduced sometimes.

-- Backtrace:
Application: Nepomuk Service Stub (nepomukservicestub), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[KCrash Handler]
#6  0x00007f52d1725367 in QBasicAtomicInt::operator!= (this=0x6b0075006d0010, value=1) at /usr/include/qt4/QtCore/qbasicatomic.h:75
#7  0x00007f52d1735fce in QHash<ContactIdentifier, ContactResources>::detach (this=0x22e7040) at /usr/include/qt4/QtCore/qhash.h:303
#8  0x00007f52d1734226 in QHash<ContactIdentifier, ContactResources>::insert (this=0x22e7040, akey=..., avalue=...) at /usr/include/qt4/QtCore/qhash.h:756
#9  0x00007f52d173106e in NepomukStorage::createContact (this=0x22e7020, path=..., contact=...) at /opt/telepathy/ktp-common-internals/kpeople/nepomuk-feeder/nepomuk-storage.cpp:644
#10 0x00007f52d1732aff in NepomukStorage::qt_static_metacall (_o=0x22e7020, _c=QMetaObject::InvokeMetaMethod, _id=7, _a=0x7fff3f82cea0) at /opt/telepathy/ktp-common-internals/build/kpeople/nepomuk-feeder/nepomuk-storage.moc:87
#11 0x00007f52e26b84c8 in QMetaObject::activate (sender=0x266b800, m=<optimized out>, local_signal_index=<optimized out>, argv=0x7fff3f82cea0) at kernel/qobject.cpp:3547
#12 0x00007f52d172b0ff in Account::contactCreated (this=0x266b800, _t1=..., _t2=...) at /opt/telepathy/ktp-common-internals/build/kpeople/nepomuk-feeder/account.moc:204
#13 0x00007f52d172a399 in Account::onNewContact (this=0x266b800, contact=...) at /opt/telepathy/ktp-common-internals/kpeople/nepomuk-feeder/account.cpp:180
#14 0x00007f52d1729cf9 in Account::onContactManagerStateChanged (this=0x266b800, state=Tp::ContactListStateSuccess) at /opt/telepathy/ktp-common-internals/kpeople/nepomuk-feeder/account.cpp:124
#15 0x00007f52d1729a55 in Account::onConnectionChanged (this=0x266b800, connection=...) at /opt/telepathy/ktp-common-internals/kpeople/nepomuk-feeder/account.cpp:104
#16 0x00007f52d17294b1 in Account::init (this=0x266b800) at /opt/telepathy/ktp-common-internals/kpeople/nepomuk-feeder/account.cpp:69
#17 0x00007f52d1726d3e in Controller::onNewAccount (this=0x23c8c20, account=...) at /opt/telepathy/ktp-common-internals/kpeople/nepomuk-feeder/controller.cpp:158
#18 0x00007f52d1726831 in Controller::onAccountManagerReady (this=0x23c8c20, op=0x23085c0) at /opt/telepathy/ktp-common-internals/kpeople/nepomuk-feeder/controller.cpp:125
#19 0x00007f52d1726f3b in Controller::qt_static_metacall (_o=0x23c8c20, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fff3f82d490) at /opt/telepathy/ktp-common-internals/build/kpeople/nepomuk-feeder/controller.moc:57
#20 0x00007f52e26b84c8 in QMetaObject::activate (sender=sender@entry=0x23085c0, m=m@entry=0x7f52d16cd6c0 <Tp::PendingOperation::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fff3f82d490) at kernel/qobject.cpp:3547
#21 0x00007f52d12ec75f in Tp::PendingOperation::finished (this=this@entry=0x23085c0, _t1=_t1@entry=0x23085c0) at /opt/telepathy/telepathy-qt/build/TelepathyQt/_gen/pending-operation.moc.hpp:111
#22 0x00007f52d12ec7a1 in Tp::PendingOperation::emitFinished (this=0x23085c0) at /opt/telepathy/telepathy-qt/TelepathyQt/pending-operation.cpp:123
#23 0x00007f52e26bc87e in QObject::event (this=0x23085c0, e=<optimized out>) at kernel/qobject.cpp:1194
#24 0x00007f52e098275c in QApplicationPrivate::notify_helper (this=this@entry=0x21470e0, receiver=receiver@entry=0x23085c0, e=e@entry=0x24270a0) at kernel/qapplication.cpp:4567
#25 0x00007f52e0988dd0 in QApplication::notify (this=this@entry=0x7fff3f82dbf0, receiver=receiver@entry=0x23085c0, e=e@entry=0x24270a0) at kernel/qapplication.cpp:4353
#26 0x00007f52e19a9cfa in KApplication::notify (this=0x7fff3f82dbf0, receiver=0x23085c0, event=0x24270a0) at ../../kdeui/kernel/kapplication.cpp:311
#27 0x00007f52e26a433d in QCoreApplication::notifyInternal (this=0x7fff3f82dbf0, receiver=receiver@entry=0x23085c0, event=event@entry=0x24270a0) at kernel/qcoreapplication.cpp:949
#28 0x00007f52e26a789f in sendEvent (event=0x24270a0, receiver=0x23085c0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#29 QCoreApplicationPrivate::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0, data=0x211b190) at kernel/qcoreapplication.cpp:1573
#30 0x00007f52e26a7d43 in QCoreApplication::sendPostedEvents (receiver=receiver@entry=0x0, event_type=event_type@entry=0) at kernel/qcoreapplication.cpp:1466
#31 0x00007f52e26d1bf3 in sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#32 postEventSourceDispatch (s=0x213ffc0) at kernel/qeventdispatcher_glib.cpp:280
#33 0x00007f52df81bea6 in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#34 0x00007f52df81c1f8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#35 0x00007f52df81c29c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#36 0x00007f52e26d14b5 in QEventDispatcherGlib::processEvents (this=0x211cac0, flags=...) at kernel/qeventdispatcher_glib.cpp:425
#37 0x00007f52e0a20896 in QGuiEventDispatcherGlib::processEvents (this=<optimized out>, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#38 0x00007f52e26a2f9f in QEventLoop::processEvents (this=this@entry=0x7fff3f82dad0, flags=...) at kernel/qeventloop.cpp:149
#39 0x00007f52e26a3295 in QEventLoop::exec (this=this@entry=0x7fff3f82dad0, flags=...) at kernel/qeventloop.cpp:204
#40 0x00007f52e26a88db in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1221
#41 0x0000000000403e60 in ?? ()
#42 0x00007f52e012c995 in __libc_start_main (main=0x403540, argc=2, ubp_av=0x7fff3f82dde8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fff3f82ddd8) at libc-start.c:260
#43 0x00000000004040f1 in _start ()

Reported using DrKonqi
Comment 1 David Edmundson 2013-10-06 00:16:26 UTC
I'm able to reproduce with nepomukservicestub nepomuktelepathyservice + immediately control+C

Backtrace is coming from instance of NepomukStorage being deleted, yet it's still processing slots on that object and then crashing. I don't understand why it's calling the slots, when a qobject is deleted that shouldn't happen. It all appears to be in the main thread too.. 

I'm confused on this ATM.
Comment 2 David Edmundson 2013-10-06 10:45:35 UTC
I thought this was coming from someone calling delete myQObject in a slot, instead of 
myObject->deleteLater();

I went through all my code looking for it, and it wasn't there.. . because it's in Nepomuk code.

Will fix there.
Comment 3 David Edmundson 2013-10-06 10:50:37 UTC
Link to RB because it's not in the telepathy modules: https://git.reviewboard.kde.org/r/113128/
Comment 4 David Edmundson 2013-10-07 13:43:00 UTC
Git commit 8ae2589a15cef0c434e07ab6e76124405451fe2e by David Edmundson.
Committed on 06/10/2013 at 11:46.
Pushed by davidedmundson into branch 'master'.

Don't delete a QObject from inside a slot.

If there are any pending calls to that object to be processed deleting
the object can cause them to crash. (such as in KTp's service)

Using deleteLater() is safer.
REVIEW: 113128

M  +1    -1    servicestub/servicecontrol.cpp

http://commits.kde.org/nepomuk-core/8ae2589a15cef0c434e07ab6e76124405451fe2e
Comment 5 David Edmundson 2013-10-07 13:50:59 UTC
Git commit ea58ef8052a9b16000da5ed83e7707cbdfa8f666 by David Edmundson.
Committed on 06/10/2013 at 11:46.
Pushed by davidedmundson into branch 'KDE/4.11'.

Don't delete a QObject from inside a slot.

If there are any pending calls to that object to be processed deleting
the object can cause them to crash. (such as in KTp's service)

Using deleteLater() is safer.
REVIEW: 113128

M  +1    -1    servicestub/servicecontrol.cpp

http://commits.kde.org/nepomuk-core/ea58ef8052a9b16000da5ed83e7707cbdfa8f666