Bug 116573 - Crash after plugin unload
Summary: Crash after plugin unload
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: History Plugin (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-11-17 18:21 UTC by Tommi Rantala
Modified: 2008-12-29 22:05 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tommi Rantala 2005-11-17 18:21:35 UTC
Version:           0.11 (branches/KDE/3.5 build) (using KDE KDE 3.5.0)
Installed from:    Compiled From Sources
Compiler:          gcc 4.0.3 20051006 (prerelease) 
OS:                Linux

1. $ kopete
2. connect to some irc server
3. plugins -> enable history plugin
4. join a channel, send one message
5. plugins -> disable history plugin
6. send a message to the same channel

=> SIGSEGV



kopete (irc - raw protocol): (25 bytes) >> PRIVMSG #foofoofoo :moi
kopete (history): [void HistoryLogger::saveToDisk()] /home/ttrantal/.kde/share/apps/kopete/logs/IRCProtocol/EFNet_2/#foofoofoo.200511.xml saved in 22 ms
libkopete: [void Kopete::PluginManager::slotPluginReadyForUnload()] HistoryPluginready for unload
kopete (irc): #foofoofoo has codec 0x8138da0
kopete (irc - raw protocol): (25 bytes) >> PRIVMSG #foofoofoo :moi
KCrash: Application 'kopete' crashing...



Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread 1105203072 (LWP 14309)]
[KCrash handler]
#7  0x4428f5b1 in QMapPrivate<Kopete::ChatSession*, HistoryGUIClient*>::end (this=0x0) at qmap.h:380
#8  0x4428f5e7 in QMap<Kopete::ChatSession*, HistoryGUIClient*>::end (this=0x85da2fc) at qmap.h:663
#9  0x4428f60c in QMap<Kopete::ChatSession*, HistoryGUIClient*>::contains (this=0x85da2fc, k=@0xbfdd4934)
    at qmap.h:703
#10 0x4428d15c in HistoryPlugin::messageDisplayed (this=0x85da2b8, m=@0xbfdd4980) at historyplugin.cpp:105
#11 0x4428d2e2 in HistoryMessageLogger::handleMessage (this=0x8615ad8, event=0x815c0b0) at historyplugin.cpp:96
#12 0x40108abb in Kopete::MessageHandler::handleMessageInternal (this=0x8615ad8, event=0x815c0b0)
    at kopetemessagehandler.cpp:60
#13 0x4010a22f in Kopete::ProcessMessageTask::slotStart (this=0x8634018) at kopetemessagehandlerchain.cpp:166
#14 0x4010a638 in Kopete::ProcessMessageTask::qt_invoke (this=0x8634018, _id=5, _o=0xbfdd4a54)
    at kopetemessagehandlerchain.moc:159
#15 0x41308cd9 in QObject::activate_signal () from /opt/qt/lib/libqt-mt.so.3
#16 0x416443a2 in QSignal::signal () from /opt/qt/lib/libqt-mt.so.3
#17 0x4132570b in QSignal::activate () from /opt/qt/lib/libqt-mt.so.3
#18 0x4132d073 in QSingleShotTimer::event () from /opt/qt/lib/libqt-mt.so.3
#19 0x412a9b71 in QApplication::internalNotify () from /opt/qt/lib/libqt-mt.so.3
#20 0x412aa58f in QApplication::notify () from /opt/qt/lib/libqt-mt.so.3
#21 0x40f2c50e in KApplication::notify () from /opt/kde/lib/libkdecore.so.4
#22 0x4129e9e8 in QEventLoop::activateTimers () from /opt/qt/lib/libqt-mt.so.3
#23 0x412580bf in QEventLoop::processEvents () from /opt/qt/lib/libqt-mt.so.3
#24 0x412c06c9 in QEventLoop::enterLoop () from /opt/qt/lib/libqt-mt.so.3
#25 0x412c05c6 in QEventLoop::exec () from /opt/qt/lib/libqt-mt.so.3
#26 0x412a958f in QApplication::exec () from /opt/qt/lib/libqt-mt.so.3
#27 0x0806b9fe in main (argc=1, argv=0xbfdd5114) at main.cpp:103
Comment 1 Michael Zanetti 2007-05-09 21:42:22 UTC
I can confirm this. It happens with every plugin using the newer Plugin API (MessageHandler).

Whenever a ChatSession is created while a plugin is loaded the plugin's MessageHandler is registered in the ChatSession's MessageHandlerChain. If the plugin is unloaded while a ChatSession is still open Kopete crashes on the the next message passing this MessageHandlerChain.

To prevent this the plugins MessageHandler must be removed from all MessageHandlerChains while unloading the plugin. Should Plugins care about this themselves or should this be done by Kopetes PluginManager?
Comment 2 Oliver Putz 2008-02-01 20:12:26 UTC
This crash still happens a current KDE4 SVN build.

Backtrace with ICQ Plugin:
Application: Kopete (kopete), signal SIGSEGV
Using host libthread_db library "/lib/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread 0xb5d2e6d0 (LWP 23625)]
[New Thread 0xb3b05b90 (LWP 23851)]
[KCrash handler]
#6  QMap<Kopete::ChatSession*, HistoryGUIClient*>::findNode (this=0x80c7bf8, 
    akey=@0xbf95f28c) at /usr/include/qt4/QtCore/qmap.h:417
#7  0xb3d18679 in QMap<Kopete::ChatSession*, HistoryGUIClient*>::contains (
    this=0x80c7bf8, akey=@0xbf95f28c) at /usr/include/qt4/QtCore/qmap.h:486
#8  0xb3d16fc9 in HistoryPlugin::messageDisplayed (this=0x80c7bd8, 
    m=@0xbf95f2c8)
    at /var/tmp/portage/kde-base/kdenetwork-9999.4/work/kdenetwork-9999.4/kopete/plugins/history/historyplugin.cpp:110
#9  0xb3d17031 in HistoryMessageLogger::handleMessage (this=0x85170f0, 
    event=0x81ab680)
    at /var/tmp/portage/kde-base/kdenetwork-9999.4/work/kdenetwork-9999.4/kopete/plugins/history/historyplugin.cpp:101
#10 0xb6c46585 in Kopete::MessageHandler::handleMessageInternal (
    this=0x85170f0, event=0x81ab680)
    at /var/tmp/portage/kde-base/kdenetwork-9999.4/work/kdenetwork-9999.4/kopete/libkopete/kopetemessagehandler.cpp:60
#11 0xb6c44659 in Kopete::ProcessMessageTask::start (this=0x87c1a98)
    at /var/tmp/portage/kde-base/kdenetwork-9999.4/work/kdenetwork-9999.4/kopete/libkopete/kopetemessagehandlerchain.cpp:166
#12 0xb6c445ef in Kopete::ProcessMessageTask::qt_metacall (this=0x87c1a98, 
    _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0xbf95f7d4)
    at /var/tmp/portage/kde-base/kdenetwork-9999.4/work/kdenetwork_build/kopete/libkopete/kopetemessagehandlerchain.moc:109
#13 0xb7ea01f4 in QMetaObject::activate (sender=0x88cb2a0, 
    from_signal_index=4, to_signal_index=4, argv=<value optimized out>)
    at kernel/qobject.cpp:3081
#14 0xb7ea0d94 in QMetaObject::activate (sender=0x88cb2a0, m=0xb7f3ec64, 
    local_signal_index=0, argv=0x0) at kernel/qobject.cpp:3140
#15 0xb7ea93c3 in QSingleShotTimer::timeout (this=0x88cb2a0)
    at .moc/debug-shared/qtimer.moc:73
#16 0xb7ea940c in QSingleShotTimer::timerEvent (this=0x88cb2a0)
    at kernel/qtimer.cpp:296
#17 0xb7e9e269 in QObject::event (this=0x88cb2a0, e=0x88fc39c)
    at kernel/qobject.cpp:1086
#18 0xb6e03e8a in QApplicationPrivate::notify_helper (this=0x80bd208, 
    receiver=0x88cb2a0, e=0xbf95fd08) at kernel/qapplication.cpp:3556
#19 0xb6e0577a in QApplication::notify (this=0xbf95ff88, receiver=0x88cb2a0, 
    e=0xbf95fd08) at kernel/qapplication.cpp:3115
#20 0xb7935c03 in KApplication::notify (this=0xbf95ff88, receiver=0x88cb2a0, 
    event=0xbf95fd08)
    at /var/tmp/portage/kde-base/kdelibs-9999.4/work/kdelibs-9999.4/kdeui/kernel/kapplication.cpp:311
#21 0xb7e8cd7b in QCoreApplication::notifyInternal (this=0xbf95ff88, 
    receiver=0x88cb2a0, event=0xbf95fd08) at kernel/qcoreapplication.cpp:530
#22 0xb7eb5efb in QTimerInfoList::activateTimers (this=0x80be544)
    at kernel/qcoreapplication.h:200
#23 0xb7eb5fd1 in QEventDispatcherUNIX::activateTimers (this=0x80c4e38)
    at kernel/qeventdispatcher_unix.cpp:828
#24 0xb7eb69ab in QEventDispatcherUNIX::processEvents (this=0x80c4e38, 
    flags=@0xbf95fe88) at kernel/qeventdispatcher_unix.cpp:890
#25 0xb6e8dcce in QEventDispatcherX11::processEvents (this=0x80c4e38, 
    flags=@0xbf95feb4) at kernel/qeventdispatcher_x11.cpp:145
#26 0xb7e8c191 in QEventLoop::processEvents (this=0xbf95ff20, 
    flags=@0xbf95fee8) at kernel/qeventloop.cpp:140
#27 0xb7e8c29a in QEventLoop::exec (this=0xbf95ff20, flags=@0xbf95ff28)
    at kernel/qeventloop.cpp:186
#28 0xb7e8e626 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:759
#29 0xb6e03487 in QApplication::exec () at kernel/qapplication.cpp:3053
#30 0x080891ec in main (argc=138211496, argv=0x1)
    at /var/tmp/portage/kde-base/kdenetwork-9999.4/work/kdenetwork-9999.4/kopete/kopete/main.cpp:102
#31 0xb5fb2fdc in __libc_start_main (main=0x8087250 <main>, argc=1, 
    ubp_av=0xbf960374, init=0x80986f0 <__libc_csu_init>, 
    fini=0x80986e0 <__libc_csu_fini>, rtld_fini=0xb7f50100 <_dl_fini>, 
    stack_end=0xbf96036c) at libc-start.c:229
#32 0x08064411 in _start ()
#0  0xffffe410 in __kernel_vsyscall ()
Comment 3 George Kiagiadakis 2008-07-23 13:23:33 UTC
Reproducable in KDE 4.0.99. Doesn't require irc specifially, I reproduced it with jabber.
Backtrace:

Application: Kopete (kopete), signal SIGSEGV
[Thread debugging using libthread_db enabled]
[New Thread 0x7fa9fc43e780 (LWP 30410)]
[New Thread 0x411dd950 (LWP 30418)]
[KCrash handler]
#5  0x00007fa9f88cb244 in QObject::connect (sender=0x19bc3b0, 
    signal=0x7fa9e7aaa641 "closing(Kopete::ChatSession*)", receiver=0xc85d70, 
    method=0x7fa9e7aaa619 "slotKMMClosed(Kopete::ChatSession*)", 
    type=Qt::AutoConnection) at kernel/qobject.cpp:2391
#6  0x00007fa9e7a8fbfb in HistoryPlugin::messageDisplayed (this=0xc85d70, 
    m=@0x7fff0457b210)
    at /tmp/buildd/kdenetwork-4.0.98/kopete/plugins/history/historyplugin.cpp:114
#7  0x00007fa9e7a8ff5d in HistoryMessageLogger::handleMessage (
    this=0x1069e40, event=0x19c11c0)
    at /tmp/buildd/kdenetwork-4.0.98/kopete/plugins/history/historyplugin.cpp:101
#8  0x00007fa9fb68f5da in Kopete::ProcessMessageTask::qt_metacall (
    this=0x1941a40, _c=QMetaObject::InvokeMetaMethod, _id=0, 
    _a=<value optimized out>)
    at /tmp/buildd/kdenetwork-4.0.98/obj-x86_64-linux-gnu/kopete/libkopete/kopetemessagehandlerchain.moc:110
#9  0x00007fa9f88ce764 in QMetaObject::activate (sender=0x2124620, 
    from_signal_index=<value optimized out>, to_signal_index=4, argv=0x4)
    at kernel/qobject.cpp:3010
#10 0x00007fa9f88d4a4f in QSingleShotTimer::timerEvent (this=0x2124620)
    at kernel/qtimer.cpp:300
#11 0x00007fa9f88c9073 in QObject::event (this=0x2124620, e=0x7fa9fb6db8f7)
    at kernel/qobject.cpp:1105
#12 0x00007fa9f94fbe5d in QApplicationPrivate::notify_helper (this=0x699ec0, 
    receiver=0x2124620, e=0x7fff0457b9b0) at kernel/qapplication.cpp:3772
#13 0x00007fa9f9503b2a in QApplication::notify (this=0x7fff0457bcd0, 
    receiver=0x2124620, e=0x7fff0457b9b0) at kernel/qapplication.cpp:3739
#14 0x00007fa9fa4eab7b in KApplication::notify (this=0x7fff0457bcd0, 
    receiver=0x2124620, event=0x7fff0457b9b0)
    at /build/buildd/kde4libs-4.0.98+svn833207/kdeui/kernel/kapplication.cpp:311
#15 0x00007fa9f88ba411 in QCoreApplication::notifyInternal (
    this=0x7fff0457bcd0, receiver=0x2124620, event=0x7fff0457b9b0)
    at kernel/qcoreapplication.cpp:587
#16 0x00007fa9f88e63b6 in QTimerInfoList::activateTimers (this=0x6ad3e0)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:215
#17 0x00007fa9f88e28dd in timerSourceDispatch (source=<value optimized out>)
    at kernel/qeventdispatcher_glib.cpp:166
#18 0x00007fa9f44b50f2 in g_main_context_dispatch ()
   from /usr/lib/libglib-2.0.so.0
#19 0x00007fa9f44b8396 in ?? () from /usr/lib/libglib-2.0.so.0
#20 0x00007fa9f44b882f in g_main_context_iteration ()
   from /usr/lib/libglib-2.0.so.0
#21 0x00007fa9f88e283f in QEventDispatcherGlib::processEvents (this=0x688fb0, 
    flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:325
#22 0x00007fa9f958d16f in QGuiEventDispatcherGlib::processEvents (
    this=0xc85d70, flags=<value optimized out>)
    at kernel/qguieventdispatcher_glib.cpp:204
#23 0x00007fa9f88b8d22 in QEventLoop::processEvents (
    this=<value optimized out>, flags={i = 72858624})
    at kernel/qeventloop.cpp:149
#24 0x00007fa9f88b8ead in QEventLoop::exec (this=0x7fff0457bc40, flags=
      {i = 72858704}) at kernel/qeventloop.cpp:200
#25 0x00007fa9f88bb37d in QCoreApplication::exec ()
    at kernel/qcoreapplication.cpp:845
#26 0x0000000000448c6c in main (argc=1, argv=0x7fff0457ca98)
    at /tmp/buildd/kdenetwork-4.0.98/kopete/kopete/main.cpp:102
#0  0x00007fa9f81a9241 in nanosleep () from /lib/libc.so.6
Comment 4 Nicolas L. 2008-11-10 00:28:25 UTC
confirming this on current trunk
Comment 5 Nicolas L. 2008-11-10 07:39:14 UTC
the same crash exist with some other modules like OTR
Comment 6 Roman Jarosz 2008-12-29 22:05:20 UTC
SVN commit 903070 by rjarosz:

Fix crash after plugin unload.

BUG: 116573



 M  +3 -1      history/historyplugin.cpp  
 M  +2 -1      history/historyplugin.h  
 M  +7 -2      otr/otrplugin.cpp  
 M  +2 -1      otr/otrplugin.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=903070