Bug 271943 - Random crash when connecting
Summary: Random crash when connecting
Status: RESOLVED FIXED
Alias: None
Product: telepathy
Classification: Unmaintained
Component: contactlist (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR crash
Target Milestone: 0.4.0
Assignee: Telepathy Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-28 22:45 UTC by David Edmundson
Modified: 2012-07-06 12:47 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Edmundson 2011-04-28 22:45:34 UTC
Version:           unspecified
OS:                Linux

Application: Telepathy KDE Contact List (telepathy-kde-contactlist), signal: Segmentation fault
[Current thread is 1 (Thread 0x7fb944da9780 (LWP 3090))]

Thread 6 (Thread 0x7fb9320e3700 (LWP 3091)):
#0  0x00007fb940ea9f03 in poll () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007fb93dda8104 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007fb93dda8639 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007fb942729446 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#4  0x00007fb9426fd882 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#5  0x00007fb9426fdabc in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#6  0x00007fb942614924 in QThread::exec() () from /usr/lib/libQtCore.so.4
#7  0x00007fb9426dfc2f in ?? () from /usr/lib/libQtCore.so.4
#8  0x00007fb942617175 in ?? () from /usr/lib/libQtCore.so.4
#9  0x00007fb93eef9d8c in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#10 0x00007fb940eb704d in clone () from /lib/x86_64-linux-gnu/libc.so.6
#11 0x0000000000000000 in ?? ()

Thread 5 (Thread 0x7fb931861700 (LWP 3109)):
#0  0x00007fb93eefef2b in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007fb94261779e in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007fb94260c218 in ?? () from /usr/lib/libQtCore.so.4
#3  0x00007fb942617175 in ?? () from /usr/lib/libQtCore.so.4
#4  0x00007fb93eef9d8c in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#5  0x00007fb940eb704d in clone () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 4 (Thread 0x7fb931060700 (LWP 3110)):
#0  0x00007fb93eefef2b in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007fb94261779e in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007fb94260c218 in ?? () from /usr/lib/libQtCore.so.4
#3  0x00007fb942617175 in ?? () from /usr/lib/libQtCore.so.4
#4  0x00007fb93eef9d8c in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#5  0x00007fb940eb704d in clone () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 3 (Thread 0x7fb93085f700 (LWP 3111)):
#0  0x00007fb93eefef2b in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007fb94261779e in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007fb94260c218 in ?? () from /usr/lib/libQtCore.so.4
#3  0x00007fb942617175 in ?? () from /usr/lib/libQtCore.so.4
#4  0x00007fb93eef9d8c in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#5  0x00007fb940eb704d in clone () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 2 (Thread 0x7fb92bfff700 (LWP 3112)):
#0  0x00007fb93eefef2b in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/x86_64-linux-gnu/libpthread.so.0
#1  0x00007fb94261779e in QWaitCondition::wait(QMutex*, unsigned long) () from /usr/lib/libQtCore.so.4
#2  0x00007fb94260c218 in ?? () from /usr/lib/libQtCore.so.4
#3  0x00007fb942617175 in ?? () from /usr/lib/libQtCore.so.4
#4  0x00007fb93eef9d8c in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#5  0x00007fb940eb704d in clone () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7fb944da9780 (LWP 3090)):
[KCrash Handler]
#6  Tp::Connection::contactManager (this=0x0) at /home/david/telepathy/telepathy-qt4/TelepathyQt4/connection.cpp:2259
#7  0x000000000043015a in MainWidget::monitorPresence (this=0x2214040, account=...) at /home/david/telepathy/telepathy-contact-list-new/main-widget.cpp:366
#8  0x0000000000430536 in MainWidget::onAccountConnectionStatusChanged (this=0x2214040, status=Tp::ConnectionStatusConnected) at /home/david/telepathy/telepathy-contact-list-new/main-widget.cpp:302
#9  0x00000000004306ed in MainWidget::qt_metacall (this=0x2214040, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff1a28a9c0) at /home/david/telepathy/telepathy-contact-list-new/build/main-widget.moc:144
#10 0x00007fb9427135f8 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#11 0x00007fb944735631 in Tp::Account::connectionStatusChanged (this=<value optimized out>, _t1=Tp::ConnectionStatusConnected) at /home/david/telepathy/telepathy-qt4/build/TelepathyQt4/_gen/account.moc.hpp:427
#12 0x00007fb9447415db in Tp::Account::Private::updateProperties (this=0x2331d20, props=<value optimized out>) at /home/david/telepathy/telepathy-qt4/TelepathyQt4/account.cpp:4058
#13 0x00007fb944745f34 in Tp::Account::qt_metacall (this=0x23314b0, _c=QMetaObject::InvokeMetaMethod, _id=27, _a=0x7fff1a28bc00) at /home/david/telepathy/telepathy-qt4/build/TelepathyQt4/_gen/account.moc.hpp:232
#14 0x00007fb9427135f8 in QMetaObject::activate(QObject*, QMetaObject const*, int, void**) () from /usr/lib/libQtCore.so.4
#15 0x00007fb9447356a5 in Tp::Client::AccountInterface::AccountPropertyChanged (this=<value optimized out>, _t1=<value optimized out>) at /home/david/telepathy/telepathy-qt4/build/TelepathyQt4/_gen/cli-account.moc.hpp:120
#16 0x00007fb94473c684 in Tp::Client::AccountInterface::qt_metacall (this=0x22c7d10, _c=QMetaObject::InvokeMetaMethod, _id=1, _a=0x7fff1a28bdf0) at /home/david/telepathy/telepathy-qt4/build/TelepathyQt4/_gen/cli-account.moc.hpp:90
#17 0x00007fb942a539fa in ?? () from /usr/lib/libQtDBus.so.4
#18 0x00007fb942a5de4f in ?? () from /usr/lib/libQtDBus.so.4
#19 0x00007fb94271249a in QObject::event(QEvent*) () from /usr/lib/libQtCore.so.4
#20 0x00007fb941abf9e4 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#21 0x00007fb941ac43aa in QApplication::notify(QObject*, QEvent*) () from /usr/lib/libQtGui.so.4
#22 0x00007fb944271866 in KApplication::notify(QObject*, QEvent*) () from /usr/lib/libkdeui.so.5
#23 0x00007fb9426fe49c in QCoreApplication::notifyInternal(QObject*, QEvent*) () from /usr/lib/libQtCore.so.4
#24 0x00007fb942701c25 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /usr/lib/libQtCore.so.4
#25 0x00007fb942729253 in ?? () from /usr/lib/libQtCore.so.4
#26 0x00007fb93dda7bcd in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#27 0x00007fb93dda83a8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#28 0x00007fb93dda8639 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#29 0x00007fb9427293ef in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#30 0x00007fb941b66dfe in ?? () from /usr/lib/libQtGui.so.4
#31 0x00007fb9426fd882 in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#32 0x00007fb9426fdabc in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/libQtCore.so.4
#33 0x00007fb942701ecb in QCoreApplication::exec() () from /usr/lib/libQtCore.so.4
#34 0x000000000042854c in main (argc=1, argv=<value optimized out>) at /home/david/telepathy/telepathy-contact-list-new/main.cpp:60

Reading that, the cause is that account->connection() returns 0.

The backtrace has it being called from onAccountConnectionStatusChanged

I think that simply checking "account->connectionStatus() == Tp::ConnectionStatusConnected"
Does not always mean that account->connection() will work.


Reproducible: Didn't try
Comment 1 David Edmundson 2011-04-29 14:07:17 UTC
[13:13] <oggis_> d_ed: that is a bit confusing, but also there are time windows during which account->connectionStatus() and account->connection()->status() aren't the same
[13:14] <oggis_> because account->connectionStatus() is the status which MC has picked up and then signaled to tp-qt4
[13:14] <oggis_> while Connection::status() is the status got from the CM directly, except changes to it are also delayed until all the state for the new status has been downloaded
[13:15] <oggis_> in essence you shouldn't use Account::connectionStatus() for much more than maybe GUI display on whether an account is connected / connecting / offline
[13:15] <d_ed> ok, what I have is we're checking account->connectionStatus, then doing account->connection()->contactManager() 
[13:15] <d_ed> and it's crashing because connection() returns 0
[13:15] <oggis_> no, you'll die
[13:15] <oggis_> check account->connection() for being non-NULL, then use it :)
[13:16] <oggis_> and you should be listening to the connectionChanged() signal as well - not using connectionStatusChanged() for that purpose
[13:16] <d_ed> "as well" or "instead of"
[13:17] <oggis_> listen to that signal as well, instead of using connectionStatusChanged() for that purpose
[13:17] <oggis_> as well as in in addition to checking for connection() being non-NULL
Comment 2 David Edmundson 2011-05-05 22:30:16 UTC
Git commit be28fa3db185265a3db7ebffe90fc056f76a5e82 by David Edmundson.
Committed on 04/05/2011 at 17:59.
Pushed by davidedmundson into branch 'master'.

Check for connection being valid rather than looking at the connection status before calling monitor presence.

There are times when connectionStatus is Connected, but account->connection() returns 0.
Converted code to call monitorPresence when connectionChanges() not connectionStatusChanges.

Also updated monitorPresence to take a connectionPtr rather than accountPtr as it makes the code easier with this new change.

REVIEW: 101288
BUG: 271943

M  +11   -10   main-widget.cpp     
M  +1    -1    main-widget.h     

http://commits.kde.org/telepathy-contact-list/be28fa3db185265a3db7ebffe90fc056f76a5e82