Bug 219985 - Konversation crash when certain strings received
Summary: Konversation crash when certain strings received
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: knotify (show other bugs)
Version: unspecified
Platform: Unlisted Binaries Linux
: NOR crash
Target Milestone: ---
Assignee: Olivier Goffart
URL:
Keywords:
: 225690 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-12-24 19:48 UTC by Ken Rushia
Modified: 2010-03-23 12:55 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
IRC protocol dump (17.27 KB, application/octet-stream)
2009-12-24 21:10 UTC, Nicolás Alvarez
Details
Crash backtrace (5.31 KB, text/plain)
2009-12-25 13:52 UTC, Eike Hein
Details
Crash backtrace with config dialog involvement (7.84 KB, text/plain)
2009-12-25 13:54 UTC, Eike Hein
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ken Rushia 2009-12-24 19:48:45 UTC
Application that crashed: konversation
Version of the application: 1.2.1
KDE Version: 4.3.4 (KDE 4.3.4)
Qt Version: 4.6.0
Operating System: Linux 2.6.31-gentoo-r1 x86_64
Distribution: "Funtoo Linux - baselayout 2.1.6"

What I was doing when the application crashed:
Konversation crashes shortly after strings such as the example below are received. Note it is copied from log file so may not be 100% exact.

[Thursday 24 December 2009] [13:45:07] <kama>   yes?
[Thursday 24 December 2009] [13:45:11] <krushia>        crash me
[Thursday 24 December 2009] [13:45:14] <krushia>        please :)
[Thursday 24 December 2009] [13:45:25] <kama>   are you sure?
[Thursday 24 December 2009] [13:45:26] <kama>   ok..
[Thursday 24 December 2009] [13:45:31] <kama>   UniSearch <e>: EeèéêëÄÄÄÄÄÈÈ©áµá¸á¸º¹áº»áº½ââ¯ââ âããï½ðððð®ð¢ððð¾ð²ð¦ððó ¥

 -- Backtrace:
Application: Konversation (konversation), signal: Segmentation fault
[Current thread is 1 (Thread 0x7f43e1f96740 (LWP 19552))]

Thread 2 (Thread 0x7f43d10c7950 (LWP 19553)):
#0  0x00007f43dcfc7dc9 in pthread_cond_wait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
#1  0x00007f43de425ce9 in QWaitConditionPrivate::wait (this=0x2253280, mutex=0x2253278, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:87
#2  QWaitCondition::wait (this=0x2253280, mutex=0x2253278, time=18446744073709551615) at thread/qwaitcondition_unix.cpp:159
#3  0x00007f43df80674c in QHostInfoAgent::run (this=0x2253260) at kernel/qhostinfo.cpp:252
#4  0x00007f43de424e25 in QThreadPrivate::start (arg=0x2253260) at thread/qthread_unix.cpp:244
#5  0x00007f43dcfc4017 in start_thread () from /lib/libpthread.so.0
#6  0x00007f43dd2a8f4d in clone () from /lib/libc.so.6
#7  0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7f43e1f96740 (LWP 19552)):
[KCrash Handler]
#5  QObject::d_func (sender=0x0, m=<value optimized out>, local_signal_index=1, argv=0x7fff9ec34050) at kernel/qobject.h:121
#6  QMetaObject::activate (sender=0x0, m=<value optimized out>, local_signal_index=1, argv=0x7fff9ec34050) at kernel/qobject.cpp:3209
#7  0x00007f43de8844ba in QDBusConnectionPrivate::callWithCallbackFailed (this=0x2, _t1=<value optimized out>, _t2=<value optimized out>) at .moc/release-shared/moc_qdbusconnection_p.cpp:118
#8  0x00007f43de852ae8 in QDBusConnectionPrivate::processFinishedCall (call=0x3d960a0) at qdbusintegrator.cpp:1724
#9  0x00007f43de857633 in QDBusConnectionPrivate::sendWithReplyAsync (this=0x1c43f20, message=<value optimized out>, receiver=0x23d9dd0, returnMethod=0x7f43df2a3ee2 "1slotReceivedId(int)", 
    errorMethod=0x7f43df2a3f78 "1slotReceivedIdError(QDBusError)", timeout=<value optimized out>) at qdbusintegrator.cpp:1946
#10 0x00007f43de844f6d in QDBusConnection::callWithCallback (this=0x22f5780, message=..., receiver=0x3, returnMethod=0x3 <Address 0x3 out of bounds>, errorMethod=0x7f43de5c0020 "\004", timeout=4)
    at qdbusconnection.cpp:461
#11 0x00007f43de85d535 in QDBusAbstractInterface::callWithCallback (this=<value optimized out>, method=..., args=..., receiver=0x23d9dd0, returnMethod=0x7f43df2a3ee2 "1slotReceivedId(int)", 
    errorMethod=0x7f43df2a3f78 "1slotReceivedIdError(QDBusError)") at qdbusabstractinterface.cpp:518
#12 0x00007f43df1a7ba7 in KNotificationManager::notify (this=0x2298130, n=0x23d9dd0, pix=<value optimized out>, actions=..., contexts=<value optimized out>, appname=...)
    at /var/tmp/portage/kde-base/kdelibs-4.3.4/work/kdelibs-4.3.4/kdeui/util/knotificationmanager.cpp:139
#13 0x00007f43df1a527d in KNotification::sendEvent (this=0x23d9dd0) at /var/tmp/portage/kde-base/kdelibs-4.3.4/work/kdelibs-4.3.4/kdeui/util/knotification.cpp:345
#14 0x00007f43df1a63e8 in KNotification::qt_metacall (this=0x23d9dd0, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff9ec34660)
    at /var/tmp/portage/kde-base/kdelibs-4.3.4/work/kdelibs-4.3.4_build/kdeui/knotification.moc:109
#15 0x00007f43de52c72f in QMetaObject::activate (sender=0x3b18430, m=<value optimized out>, local_signal_index=<value optimized out>, argv=0x3) at kernel/qobject.cpp:3286
#16 0x00007f43de53346f in QSingleShotTimer::timerEvent (this=0x3b18430) at kernel/qtimer.cpp:308
#17 0x00007f43de528b33 in QObject::event (this=0x3b18430, e=0x0) at kernel/qobject.cpp:1216
#18 0x00007f43dd9f3c7d in QApplicationPrivate::notify_helper (this=0x1c58880, receiver=0x3b18430, e=0x7fff9ec34e30) at kernel/qapplication.cpp:4242
#19 0x00007f43dd9fc493 in QApplication::notify (this=0x7fff9ec35170, receiver=0x3b18430, e=0x7fff9ec34e30) at kernel/qapplication.cpp:3661
#20 0x00007f43df137f1b in KApplication::notify (this=0x7fff9ec35170, receiver=0x3b18430, event=0x7fff9ec34e30)
    at /var/tmp/portage/kde-base/kdelibs-4.3.4/work/kdelibs-4.3.4/kdeui/kernel/kapplication.cpp:302
#21 0x00007f43de518bb3 in QCoreApplication::notifyInternal (this=0x7fff9ec35170, receiver=0x3b18430, event=0x7fff9ec34e30) at kernel/qcoreapplication.cpp:704
#22 0x00007f43de5465a4 in QCoreApplication::sendEvent (this=0x1c74ce0) at kernel/qcoreapplication.h:215
#23 QTimerInfoList::activateTimers (this=0x1c74ce0) at kernel/qeventdispatcher_unix.cpp:603
#24 0x00007f43de542eb8 in timerSourceDispatch (source=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:184
#25 idleTimerSourceDispatch (source=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:231
#26 0x00007f43d95e0001 in g_main_dispatch (context=0x1c5b020) at gmain.c:1960
#27 IA__g_main_context_dispatch (context=0x1c5b020) at gmain.c:2513
#28 0x00007f43d95e38c8 in g_main_context_iterate (context=0x1c5b020, block=1, dispatch=1, self=<value optimized out>) at gmain.c:2591
#29 0x00007f43d95e3a8c in IA__g_main_context_iteration (context=0x1c5b020, may_block=1) at gmain.c:2654
#30 0x00007f43de542b8c in QEventDispatcherGlib::processEvents (this=0x1c4d550, flags=<value optimized out>) at kernel/qeventdispatcher_glib.cpp:407
#31 0x00007f43dda8ff3f in QGuiEventDispatcherGlib::processEvents (this=0x2, flags=<value optimized out>) at kernel/qguieventdispatcher_glib.cpp:202
#32 0x00007f43de5174e2 in QEventLoop::processEvents (this=<value optimized out>, flags=...) at kernel/qeventloop.cpp:149
#33 0x00007f43de5178b4 in QEventLoop::exec (this=0x7fff9ec350e0, flags=...) at kernel/qeventloop.cpp:201
#34 0x00007f43de519d26 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:981
#35 0x0000000000466401 in main (argc=5, argv=0x7fff9ec35e88) at /var/tmp/portage/net-irc/konversation-1.2.1/work/konversation-1.2.1/src/main.cpp:98

Reported using DrKonqi
Comment 1 Dario Andres 2009-12-24 20:09:56 UTC
This is likely to be bug 199485. Regards
Comment 2 Nicolás Alvarez 2009-12-24 21:02:57 UTC
I did some more tests, getting my konversation crashed while I logged the incoming IRC data from netcat. Attaching the log.

Every time PovAdct_crash quits, it crashed.

I edited the log a bit to show lines I manually sent from netcat, so the conversation makes sense. Everything else is what I received from the IRC server directly.
Comment 3 Nicolás Alvarez 2009-12-24 21:10:49 UTC
Created attachment 39319 [details]
IRC protocol dump
Comment 4 Eike Hein 2009-12-25 13:52:34 UTC
Created attachment 39329 [details]
Crash backtrace

A better backtrace, after sending a few messages with the magic chars and a few with plain ASCII in a query from irssi to Konvi.
Comment 5 Eike Hein 2009-12-25 13:54:50 UTC
Created attachment 39330 [details]
Crash backtrace with config dialog involvement

Another, somewhat more interesting backtrace. This happens when opening the Konversation settings dialog after sending a few messages containing the magic chars and sending a few messages containing plan ASCII in a query from irssi to Konvi. It crashes immediately after clicking "Configure Konversation" in the menu.

According to the backtrace, it hits a Q_ASSERT(false) in qdbusintegrator.cpp:2033.
Comment 6 Eike Hein 2009-12-25 13:55:55 UTC
Since all the backtraces end up in QDbus code I'm adding Thiago to the CC list.

Thiago, any ideas?
Comment 7 Eike Hein 2009-12-25 14:05:43 UTC
Valgrind:

==12162== Invalid read of size 4
==12162==    at 0x551BEEE: QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::data() const (qscopedpointer.h:135)
==12162==    by 0x5534308: QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::pointer qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > >(QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > const&) (qglobal.h:2317)
==12162==    by 0x55343AD: QObject::d_func() (qobject.h:125)
==12162==    by 0x566F3E0: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (qobject.cpp:3188)
==12162==    by 0x54AB916: QDBusConnectionPrivate::callWithCallbackFailed(QDBusError const&, QDBusMessage const&) (moc_qdbusconnection_p.cpp:124)
==12162==    by 0x5474BF1: QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate*) (qdbusintegrator.cpp:1725)
==12162==    by 0x54766DC: QDBusConnectionPrivate::sendWithReplyAsync(QDBusMessage const&, QObject*, char const*, char const*, int) (qdbusintegrator.cpp:1947)
==12162==    by 0x5466723: QDBusConnection::callWithCallback(QDBusMessage const&, QObject*, char const*, char const*, int) const (qdbusconnection.cpp:461)
==12162==    by 0x5484E24: QDBusAbstractInterface::callWithCallback(QString const&, QList<QVariant> const&, QObject*, char const*, char const*) (qdbusabstractinterface.cpp:518)
==12162==    by 0x4D7D33D: KNotificationManager::notify(KNotification*, QPixmap const&, QStringList const&, QList<QPair<QString, QString> > const&, QString const&) (knotificationmanager.cpp:143)
==12162==    by 0x4D7ABAF: KNotification::sendEvent() (knotification.cpp:368)
==12162==    by 0x4D7B110: KNotification::qt_metacall(QMetaObject::Call, int, void**) (knotification.moc:109)
==12162==  Address 0xad is not stack'd, malloc'd or (recently) free'd
Comment 8 Eike Hein 2009-12-25 14:08:05 UTC
Actually, this block before the one in comment #7 looks relevant as well:

==12162== Use of uninitialised value of size 4
==12162==    at 0x551BEEE: QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::data() const (qscopedpointer.h:135)
==12162==    by 0x5534308: QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> >::pointer qGetPtrHelper<QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > >(QScopedPointer<QObjectData, QScopedPointerDeleter<QObjectData> > const&) (qglobal.h:2317)
==12162==    by 0x55343AD: QObject::d_func() (qobject.h:125)
==12162==    by 0x566F3E0: QMetaObject::activate(QObject*, QMetaObject const*, int, void**) (qobject.cpp:3188)
==12162==    by 0x54AB916: QDBusConnectionPrivate::callWithCallbackFailed(QDBusError const&, QDBusMessage const&) (moc_qdbusconnection_p.cpp:124)
==12162==    by 0x5474BF1: QDBusConnectionPrivate::processFinishedCall(QDBusPendingCallPrivate*) (qdbusintegrator.cpp:1725)
==12162==    by 0x54766DC: QDBusConnectionPrivate::sendWithReplyAsync(QDBusMessage const&, QObject*, char const*, char const*, int) (qdbusintegrator.cpp:1947)
==12162==    by 0x5466723: QDBusConnection::callWithCallback(QDBusMessage const&, QObject*, char const*, char const*, int) const (qdbusconnection.cpp:461)
==12162==    by 0x5484E24: QDBusAbstractInterface::callWithCallback(QString const&, QList<QVariant> const&, QObject*, char const*, char const*) (qdbusabstractinterface.cpp:518)
==12162==    by 0x4D7D33D: KNotificationManager::notify(KNotification*, QPixmap const&, QStringList const&, QList<QPair<QString, QString> > const&, QString const&) (knotificationmanager.cpp:143)
==12162==    by 0x4D7ABAF: KNotification::sendEvent() (knotification.cpp:368)
==12162==    by 0x4D7B110: KNotification::qt_metacall(QMetaObject::Call, int, void**) (knotification.moc:109)
Comment 9 Thiago Macieira 2009-12-25 14:42:58 UTC
The backtrace in the original post is missing key information in frames 10 and 11. Please rebuild Qt in debug mode or 32-bit.
Comment 10 Thiago Macieira 2009-12-25 14:47:47 UTC
The crash in comment 4 (attachment 39329 [details] -- please don't attach backtraces) is 32-bit. However, it's ending in a condition which is impossible: the d-pointer of a QObject is 0. The line numbers in qobject.cpp are not valid too -- they point to a line without code in Qt 4.6.0. 

Please use a PRISTINE version of Qt -- if you patch it, you take the blame for any crashes.
Comment 11 Thiago Macieira 2009-12-25 14:50:52 UTC
The crash in comment 5 is caused by a D-Bus error in the daemon. Please check your output log. It's probably the known issue in the daemon reporting that this program has exceeded the allowed number of rules.

I also see no reason to think it's related to the other crashes.
Comment 12 Thiago Macieira 2009-12-25 14:57:31 UTC
Both valgrind traces match the first two crash backtraces. They both point to the same impossible situation: the QDBusConnectionPrivate is invalid. The d-pointer is null in the crashes and in one of the valgrind traces, uninitialised in the other.

I cannot proceed. I need a testcase.
Comment 13 Eike Hein 2009-12-25 15:26:15 UTC
The Qt used for the backtrace in comment #4 was an unpatched 4.6 git from ~10 days ago or so. Unfortunately I can't post git describe output however (the clone is gone).

Considering that this apparently dropped around two dozen clients from #konversation yesterday and that it's relatively unlikely all of those were running a deviously patched Qt, I doubt it's a patch issue.

As for the valgrind output from comments #7 and #8, they're both from the same trace, actually, sorry, with #8 preceeding #7 in the original log.

Regarding producing a backtrace using Qt 4.6.0, it might be some time before I get a chance to generate one, so to everyone listening in please don't hesitate to beat me to it.
Comment 14 Eike Hein 2009-12-25 15:29:55 UTC
> I also see no reason to think it's related to the other crashes.

Well, it's reproducable every time with Konversation in the state of having received messages containing the magic chars, and I can't reproduce it otherwise, so while I have no harder info to go on, it'd be a pretty big coincidence if there wasn't a link there.
Comment 15 Nicolás Alvarez 2009-12-25 20:43:40 UTC
I looked at konversation after a crash in gdb. The PendingCall parameter passed to QDBusConnectionPrivate::processFinishedCall seems corrupted, call->connection is an invalid pointer (0x6f006900740061). So the "emit connection->callWithCallbackFailed" call crashes right afterwards.
Comment 16 Eike Hein 2009-12-25 21:19:57 UTC
As requested, here's a crash backtrace using Qt 4.6.0:

Application: Konversation (konversation), signal: Segmentation fault
[Current thread is 1 (Thread 0xb4d7b700 (LWP 27593))]

Thread 2 (Thread 0xb2e86b70 (LWP 27598)):
#0  0xb7816424 in __kernel_vsyscall ()
#1  0xb6142f65 in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:122
#2  0xb61ba2da in QWaitConditionPrivate::wait (this=0x8d1d210, mutex=0x8d1d20c, time=4294967295) at thread/qwaitcondition_unix.cpp:87
#3  QWaitCondition::wait (this=0x8d1d210, mutex=0x8d1d20c, time=4294967295) at thread/qwaitcondition_unix.cpp:159
#4  0xb67a726d in QHostInfoAgent::run (this=0x8d1d200) at kernel/qhostinfo.cpp:252
#5  0xb61b92f8 in QThreadPrivate::start (arg=0x8d1d200) at thread/qthread_unix.cpp:244
#6  0xb613e8df in start_thread (arg=0xb2e86b70) at pthread_create.c:297
#7  0xb55f519e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 1 (Thread 0xb4d7b700 (LWP 27593)):
[KCrash Handler]
#6  0xb62cb546 in QMetaObject::activate (sender=0x8d601a0, m=0xb6435d64, local_signal_index=5, argv=0xbfe048b4) at kernel/qobject.cpp:3236
#7  0xb6425ee3 in QDBusConnectionPrivate::callWithCallbackFailed (this=0x8d601a0, _t1=..., _t2=...) at .moc/debug-shared/moc_qdbusconnection_p.cpp:118
#8  0xb63f4016 in QDBusConnectionPrivate::processFinishedCall (call=0x8d97748) at qdbusintegrator.cpp:1724
#9  0xb63f8bcf in QDBusConnectionPrivate::sendWithReplyAsync (this=0x82e2580, message=..., receiver=0x84bfd08, returnMethod=0xb6c12730 "1slotReceivedId(int)",
    errorMethod=0xb6c126bc "1slotReceivedIdError(QDBusError)", timeout=-1) at qdbusintegrator.cpp:1946
#10 0xb63e6c1a in QDBusConnection::callWithCallback (this=0x8d6e078, message=..., receiver=0x84bfd08, returnMethod=0xb6c12730 "1slotReceivedId(int)",
    errorMethod=0xb6c126bc "1slotReceivedIdError(QDBusError)", timeout=-1) at qdbusconnection.cpp:461
#11 0xb640108f in QDBusAbstractInterface::callWithCallback (this=0x8ccf418, method=..., args=..., receiver=0x84bfd08, returnMethod=0xb6c12730 "1slotReceivedId(int)",
    errorMethod=0xb6c126bc "1slotReceivedIdError(QDBusError)") at qdbusabstractinterface.cpp:518
#12 0xb6aaf1d2 in KNotificationManager::notify (this=0x8d4ceb0, n=0x84bfd08, pix=..., actions=..., contexts=..., appname=...)
    at /home/kdedev/kde/src/KDE/kdelibs/kdeui/notifications/knotificationmanager.cpp:143
#13 0xb6aaca44 in KNotification::sendEvent (this=0x84bfd08) at /home/kdedev/kde/src/KDE/kdelibs/kdeui/notifications/knotification.cpp:368
#14 0xb6aacfa5 in KNotification::qt_metacall (this=0x84bfd08, _c=QMetaObject::InvokeMetaMethod, _id=13, _a=0xbfe04ce4) at /home/kdedev/kde/build/KDE/kdelibs/kdeui/knotification.moc:109
#15 0xb62bccdb in QMetaObject::metacall (object=0x84bfd08, cl=QMetaObject::InvokeMetaMethod, idx=17, argv=0xbfe04ce4) at kernel/qmetaobject.cpp:237
#16 0xb62cb802 in QMetaObject::activate (sender=0x8d97cb8, m=0xb63d21a4, local_signal_index=<value optimized out>, argv=<value optimized out>) at kernel/qobject.cpp:3286
#17 0xb62d3801 in QSingleShotTimer::timeout (this=0x8d97cb8) at .moc/debug-shared/qtimer.moc:82
#18 0xb62d3994 in QSingleShotTimer::timerEvent (this=0x8d97cb8) at kernel/qtimer.cpp:308
#19 0xb62c7e57 in QObject::event (this=0x8d97cb8, e=0xbfe050f0) at kernel/qobject.cpp:1216
#20 0xb58ec6fd in QApplicationPrivate::notify_helper (this=0x82f0690, receiver=0x8d97cb8, e=0xbfe050f0) at kernel/qapplication.cpp:4242
#21 0xb58f47fe in QApplication::notify (this=0xbfe05428, receiver=0x8d97cb8, e=0xbfe050f0) at kernel/qapplication.cpp:3661
#22 0xb6a6c1d4 in KApplication::notify (this=0xbfe05428, receiver=0x8d97cb8, event=0xbfe050f0) at /home/kdedev/kde/src/KDE/kdelibs/kdeui/kernel/kapplication.cpp:302
#23 0xb62b63ee in QCoreApplication::notifyInternal (this=0xbfe05428, receiver=0x8d97cb8, event=0xbfe050f0) at kernel/qcoreapplication.cpp:704
#24 0xb62e636d in QCoreApplication::sendEvent (this=0x82f60a4) at kernel/qcoreapplication.h:215
#25 QTimerInfoList::activateTimers (this=0x82f60a4) at kernel/qeventdispatcher_unix.cpp:603
#26 0xb62e429f in timerSourceDispatch (source=0x82f6070) at kernel/qeventdispatcher_glib.cpp:184
#27 0xb62e42ce in idleTimerSourceDispatch (source=0x82f6500) at kernel/qeventdispatcher_glib.cpp:231
#28 0xb50fda04 in g_main_dispatch (context=0x82f5a98) at gmain.c:1960
#29 IA__g_main_context_dispatch (context=0x82f5a98) at gmain.c:2513
#30 0xb5100ad9 in g_main_context_iterate (context=0x82f5a98, block=<value optimized out>, dispatch=1, self=0x82f0528) at gmain.c:2591
#31 0xb5100bb8 in IA__g_main_context_iteration (context=0x82f5a98, may_block=1) at gmain.c:2654
#32 0xb62e3e4a in QEventDispatcherGlib::processEvents (this=0x82e80c8, flags=) at kernel/qeventdispatcher_glib.cpp:407
#33 0xb59959d5 in QGuiEventDispatcherGlib::processEvents (this=0x82e80c8, flags=...) at kernel/qguieventdispatcher_glib.cpp:202
#34 0xb62b4b1a in QEventLoop::processEvents (this=0xbfe053a4, flags=) at kernel/qeventloop.cpp:149
#35 0xb62b4f11 in QEventLoop::exec (this=0xbfe053a4, flags=) at kernel/qeventloop.cpp:201
#36 0xb62b752d in QCoreApplication::exec () at kernel/qcoreapplication.cpp:981
#37 0xb58eb52f in QApplication::exec () at kernel/qapplication.cpp:3570
#38 0x080a53dd in main (argc=1, argv=0xbfe05834) at /home/kdedev/devel/src/konversation/src/main.cpp:101
Comment 17 Thiago Macieira 2009-12-25 21:47:39 UTC
Thanks Eike. But the backtrace didn't help. The crash is simply not possible at that point, short of memory corruption.

The pointer that Nicolás posted actually corroborates that hypothesis: memory smashing. Note how the pointer contains exactly 4 legal UTF-16 characters: 0x6f006900740061 (that is, the string "atio").

If this problem happens only when that string is sent, I recommend you do a step-by-step debugging of the string decoding, to see where things went wrong.

Nothing here has proved a D-Bus error, nor even a Qt bug. If you can reduce it to a Qt-only testcase, I'll take a look.
Comment 18 Eike Hein 2009-12-25 22:43:58 UTC
Alrighty -- thanks for the analysis, Thiago.

Due to the usual Christmas stuff I haven't had any time to look at this more closely yet beyond firing off the compile jobs and crashing it a few times. I guess a good approach here would be to try and write a minimal test app next that exhibits the same problem, to get the bulk of the Konvi codebase out of the way and have something easier to pass around. Since that'd probably use KNotify to mimic things it wouldn't be Qt-only straight away either, however.

The list of dupes on bug 213302 is pretty scary, however for Konvi it's especially dire of course ...

Gotta run for now unfortunately. Hope I can have a go at this at some point in the next days.
Comment 19 Olivier Goffart 2010-01-05 16:06:28 UTC
SVN commit 1070404 by ogoffart:

Fixes crash when calling KNotification::sendEvent while still waiting for id from dbus.

In that case, it could assign two id to the same notifications, resulting in crashes later.

BUG: 199485
BUG: 219985



 M  +16 -6     knotification.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1070404
Comment 20 argonel 2010-02-06 06:57:21 UTC
*** Bug 225690 has been marked as a duplicate of this bug. ***
Comment 21 argonel 2010-02-06 07:05:08 UTC
It looks like this is not solved. Konversation itself doesn't die immediately upon receipt of the message, it dies because the dbus socket is closed.

In the konsole from which konversation was launched, this message was repeated 4 times:

konversation(1531)/kdeui (KNotification) KNotification::slotReceivedIdError: Error while contacting notify daemon "Not connected to server"

I was using Qt: 4.6.1 KDE Development Platform: 4.4.60 (KDE 4.4.60 (KDE 4.5 >= 20100120)) during testing, but the original instance mentioned in bug It looks like this is not solved. Konversation itself doesn't die immediately upon receipt of the message, it dies because the dbus socket is closed.

In the konsole from which konversation was launched, this message was repeated 4 times:

konversation(1531)/kdeui (KNotification) KNotification::slotReceivedIdError: Error while contacting notify daemon "Not connected to server"

I was using Qt: 4.6.1 KDE Development Platform: 4.4.60 (KDE 4.4.60 (KDE 4.5 >= 20100120)) during testing, but the original instance mentioned in bug 225690 I was running 4.3.4 with qt 4.5.3.
Comment 22 argonel 2010-02-06 07:13:43 UTC
commit 55356dac14ebed7eed93785f046f71318653d2b4
Author: eli mackenzie <argonel@gmail.com>
Date:   Sat Feb 6 01:06:39 2010 -0500

    Disable Unicode in KNotify messages due to underlying KDE bug.
    
    CCBUG:219985

diff --git a/src/notificationhandler.cpp b/src/notificationhandler.cpp
index 9f913ca..1e0cdb7 100644
--- a/src/notificationhandler.cpp
+++ b/src/notificationhandler.cpp
@@ -37,6 +37,12 @@ namespace Konversation
     {
     }
 
+    QString cleanMessage(QString message)
+    {
+        QString cleanedMessage = Qt::escape(Konversation::removeIrcMarkup(message));
+        return cleanedMessage.toAscii();
+    }
+
     void NotificationHandler::message(ChatWindow* chatWin, const QString& fromNick, const QString& message)
     {
         if (!chatWin || !chatWin->notificationsEnabled())
@@ -45,7 +51,7 @@ namespace Konversation
         if (Preferences::self()->disableNotifyWhileAway() && chatWin->getServer() && chatWin->getServer()->isAway())
             return;
 
-        QString cleanedMessage = Qt::escape(Konversation::removeIrcMarkup(message));
+        QString cleanedMessage = cleanMessage(message);
         QString cutup = addLineBreaks(cleanedMessage);
 
         KNotification::event(QString::fromLatin1("message"), QString("<qt>&lt;%1&gt; %2</qt>").arg(fromNick).arg(cutup), QPixmap(), m_mainWindow);
@@ -73,7 +79,7 @@ namespace Konversation
         if (Preferences::self()->disableNotifyWhileAway() && chatWin->getServer() && chatWin->getServer()->isAway())
             return;
 
-        QString cleanedMessage = Qt::escape(Konversation::removeIrcMarkup(message));
+        QString cleanedMessage = cleanMessage(message);
         QString cutup = addLineBreaks(cleanedMessage);
 
         KNotification::event(QString::fromLatin1("nick"), QString("<qt>&lt;%1&gt; %2</qt>").arg(fromNick).arg(cutup), QPixmap(), m_mainWindow);
@@ -99,7 +105,7 @@ namespace Konversation
         if (Preferences::self()->disableNotifyWhileAway() && chatWin->getServer() && chatWin->getServer()->isAway())
             return;
 
-        QString cleanedMessage = Qt::escape(Konversation::removeIrcMarkup(message));
+        QString cleanedMessage = cleanMessage(message);
         QString cutup = addLineBreaks(cleanedMessage);
 
         KNotification::event(QString::fromLatin1("queryMessage"), QString("<qt>&lt;%1&gt; %2</qt>").arg(fromNick).arg(cutup), QPixmap(), m_mainWindow);
@@ -314,7 +320,7 @@ namespace Konversation
 
         startTrayNotification(chatWin);
 
-        QString cleanedMessage = Qt::escape(Konversation::removeIrcMarkup(message));
+        QString cleanedMessage = cleanMessage(message);
         QString cutup = addLineBreaks(cleanedMessage);
 
         if(fromNick.isEmpty())
Comment 23 argonel 2010-02-06 11:55:50 UTC
commit 55356dac14ebed7eed93785f046f71318653d2b4
Author: eli mackenzie <argonel@gmail.com>
Date:   Sat Feb 6 01:06:39 2010 -0500

    Disable Unicode in KNotify messages due to underlying KDE bug.
    
    CCBUG:219985

diff --git a/src/notificationhandler.cpp b/src/notificationhandler.cpp
index 9f913ca..1e0cdb7 100644
--- a/src/notificationhandler.cpp
+++ b/src/notificationhandler.cpp
@@ -37,6 +37,12 @@ namespace Konversation
     {
     }
 
+    QString cleanMessage(QString message)
+    {
+        QString cleanedMessage = Qt::escape(Konversation::removeIrcMarkup(message));
+        return cleanedMessage.toAscii();
+    }
+
     void NotificationHandler::message(ChatWindow* chatWin, const QString& fromNick, const QString& message)
     {
         if (!chatWin || !chatWin->notificationsEnabled())
@@ -45,7 +51,7 @@ namespace Konversation
         if (Preferences::self()->disableNotifyWhileAway() && chatWin->getServer() && chatWin->getServer()->isAway())
             return;
 
-        QString cleanedMessage = Qt::escape(Konversation::removeIrcMarkup(message));
+        QString cleanedMessage = cleanMessage(message);
         QString cutup = addLineBreaks(cleanedMessage);
 
         KNotification::event(QString::fromLatin1("message"), QString("<qt>&lt;%1&gt; %2</qt>").arg(fromNick).arg(cutup), QPixmap(), m_mainWindow);
@@ -73,7 +79,7 @@ namespace Konversation
         if (Preferences::self()->disableNotifyWhileAway() && chatWin->getServer() && chatWin->getServer()->isAway())
             return;
 
-        QString cleanedMessage = Qt::escape(Konversation::removeIrcMarkup(message));
+        QString cleanedMessage = cleanMessage(message);
         QString cutup = addLineBreaks(cleanedMessage);
 
         KNotification::event(QString::fromLatin1("nick"), QString("<qt>&lt;%1&gt; %2</qt>").arg(fromNick).arg(cutup), QPixmap(), m_mainWindow);
@@ -99,7 +105,7 @@ namespace Konversation
         if (Preferences::self()->disableNotifyWhileAway() && chatWin->getServer() && chatWin->getServer()->isAway())
             return;
 
-        QString cleanedMessage = Qt::escape(Konversation::removeIrcMarkup(message));
+        QString cleanedMessage = cleanMessage(message);
         QString cutup = addLineBreaks(cleanedMessage);
 
         KNotification::event(QString::fromLatin1("queryMessage"), QString("<qt>&lt;%1&gt; %2</qt>").arg(fromNick).arg(cutup), QPixmap(), m_mainWindow);
@@ -314,7 +320,7 @@ namespace Konversation
 
         startTrayNotification(chatWin);
 
-        QString cleanedMessage = Qt::escape(Konversation::removeIrcMarkup(message));
+        QString cleanedMessage = cleanMessage(message);
         QString cutup = addLineBreaks(cleanedMessage);
 
         if(fromNick.isEmpty())
Comment 24 Eike Hein 2010-02-06 18:37:53 UTC
Thiago has kindly investigated this further, and it turns out that D-Bus currently doesn't allow a range of Utf-8 characters that are reserved by the Unicode specification and not permitted for interchange. This range is U+FDD0 through U+FDEF. More information can be found here: http://www.unicode.org/charts/PDF/UFB50.pdf

There are multiple avenues to fix this:

a) QString could reject those characters.
b) QtDbus could filter out these characters.
c) KNotify could filter out these characters.
d) Konversation could filter out these characters.
e) D-Bus could not close the connection when it sees these characters.

Whether or not 'a' and 'b' are realized or not, any such change will show up in Qt 4.6.3 at the earliest, which is still some time out seeing as 4.6.2 is not yet released.

'c' might thus be a good idea for now. However, seeing how KDE 4.4.0 is already tagged, it might be too late for that release.

That means Konversation should likely do 'd' for the impending 1.2.2 release. It certainly beats the heavy-handed toAscii() call.

We should however probably not limit this filter to Qt versions older than 4.6.3, since instead of the fix being made in Qt, it might instead be made in D-Bus. Thiago has written a mail to the D-Bus mailing list where he is pursueing 'e'. See here: http://lists.freedesktop.org/archives/dbus/2010-February/012182.html
Comment 25 Eike Hein 2010-02-06 18:44:43 UTC
I have flagged the primary bug, bug #199485, as a KDE 4.4.0 blocker, but I think we should still go ahead on developing a filter for Konversation given our own release timeline and that it might be too late for 4.4.0 already. Not to mention that this also affects KDE 4.3 anyway.
Comment 26 argonel 2010-02-11 06:38:11 UTC
commit 9d90018b2bc78b22bac483861abcbad742ac7997
Author:     eli mackenzie <argonel@gmail.com>
AuthorDate: Tue Feb 9 02:43:58 2010 -0500
Commit:     eli mackenzie <argonel@gmail.com>
CommitDate: Thu Feb 11 00:27:09 2010 -0500

    Strip unusable Unicode code points because QString doesn't.
    
    Seems D-Bus closes the socket if it receives a Utf8 stream
    that it doesn't like. Presumably Qt will do this in the
    future.
    
    See bug 219985.

http://gitorious.org/konversation/konversation/commit/9d90018
Comment 27 ais523 2010-03-09 20:08:34 UTC
In case it helps, I think I just came across this bug; here's the backtrace (produced by DrKonqui, but it doesn't seem to be able to report it itself for some reason):

Application that crashed: konversation
Version of the application: 1.2
KDE Version: 4.3.2 (KDE 4.3.2)
Qt Version: 4.5.2
Operating System: Linux 2.6.31-20-generic i686
Distribution: Ubuntu 9.10

 -- Backtrace:
Application: Konversation (konversation), signal: Segmentation fault
[Current thread is 1 (Thread 0xb7804760 (LWP 27581))]

Thread 2 (Thread 0xb59b1b70 (LWP 27701)):
#0  0x00ad2422 in __kernel_vsyscall ()
#1  0x00ba1e15 in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:122
#2  0x0635e87d in __pthread_cond_wait (cond=0xa178f20, mutex=0xa178f08) at forward.c:139
#3  0x032e2e67 in QWaitConditionPrivate::wait (this=0xa06af30, mutex=0xa06af2c, time=4294967295) at thread/qwaitcondition_unix.cpp:87
#4  QWaitCondition::wait (this=0xa06af30, mutex=0xa06af2c, time=4294967295) at thread/qwaitcondition_unix.cpp:159
#5  0x0104f922 in QHostInfoAgent::run (this=0xa06af20) at kernel/qhostinfo.cpp:260
#6  0x032e1e32 in QThreadPrivate::start (arg=0xa06af20) at thread/qthread_unix.cpp:188
#7  0x00b9d80e in start_thread (arg=0xb59b1b70) at pthread_create.c:300
#8  0x063518de in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130

Thread 1 (Thread 0xb7804760 (LWP 27581)):
[KCrash Handler]
#6  0x033e8ee1 in QMetaObject::activate (sender=0x31005b, m=0xa3adc4, local_signal_index=1, argv=0xbfaec304) at kernel/qobject.cpp:3183
#7  0x00a24bc9 in QDBusConnectionPrivate::callWithCallbackFailed (this=0x31005b, _t1=..., _t2=...) at .moc/release-shared/moc_qdbusconnection_p.cpp:112
#8  0x009eab85 in QDBusConnectionPrivate::processFinishedCall (call=0xace7050) at qdbusintegrator.cpp:1689
#9  0x009f0261 in QDBusConnectionPrivate::sendWithReplyAsync (this=0x9d87258, message=..., receiver=0xa861080, returnMethod=0x785f226 "1slotReceivedId(int)", 
    errorMethod=0x785f2e0 "1slotReceivedIdError(QDBusError)", timeout=-1) at qdbusintegrator.cpp:1899
#10 0x009d9ac5 in QDBusConnection::callWithCallback (this=0xa5f099c, message=..., receiver=0xa861080, returnMethod=0x785f226 "1slotReceivedId(int)", 
    errorMethod=0x785f2e0 "1slotReceivedIdError(QDBusError)", timeout=-1) at qdbusconnection.cpp:461
#11 0x009f8290 in QDBusAbstractInterface::callWithCallback (this=0xa5ee1d8, method=..., args=..., receiver=0xa861080, returnMethod=0x785f226 "1slotReceivedId(int)", 
    errorMethod=0x785f2e0 "1slotReceivedIdError(QDBusError)") at qdbusabstractinterface.cpp:471
#12 0x07749d22 in KNotificationManager::notify (this=0xa5e0b80, n=0xa861080, pix=..., actions=..., contexts=..., appname=...) at ../../kdeui/util/knotificationmanager.cpp:143
#13 0x077473c1 in KNotification::sendEvent (this=0xa861080) at ../../kdeui/util/knotification.cpp:341
#14 0x077487a3 in KNotification::qt_metacall (this=0xa861080, _c=QMetaObject::InvokeMetaMethod, _id=17, _a=0xbfaec74c) at ./knotification.moc:103
#15 0x033e8263 in QMetaObject::activate (sender=0xae26050, from_signal_index=4, to_signal_index=4, argv=0x0) at kernel/qobject.cpp:3113
#16 0x033e8ec2 in QMetaObject::activate (sender=0xae26050, m=0x34c2908, local_signal_index=0, argv=0x0) at kernel/qobject.cpp:3187
#17 0x033ed387 in QSingleShotTimer::timeout (this=0xae26050) at .moc/release-shared/qtimer.moc:76
#18 0x033ed49c in QSingleShotTimer::timerEvent (this=0xae26050) at kernel/qtimer.cpp:298
#19 0x033e23bf in QObject::event (this=0xae26050, e=0xbfaecbe0) at kernel/qobject.cpp:1075
#20 0x01b31f54 in QApplicationPrivate::notify_helper (this=0x9dac470, receiver=0xae26050, e=0xbfaecbe0) at kernel/qapplication.cpp:4056
#21 0x01b3967c in QApplication::notify (this=0xbfaecf40, receiver=0xae26050, e=0xbfaecbe0) at kernel/qapplication.cpp:3603
#22 0x076cebfa in KApplication::notify (this=0xbfaecf40, receiver=0xae26050, event=0xbfaecbe0) at ../../kdeui/kernel/kapplication.cpp:302
#23 0x033d26cb in QCoreApplication::notifyInternal (this=0xbfaecf40, receiver=0xae26050, event=0xbfaecbe0) at kernel/qcoreapplication.cpp:610
#24 0x033ff7ce in QCoreApplication::sendEvent (this=0x9d9f99c) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:213
#25 QTimerInfoList::activateTimers (this=0x9d9f99c) at kernel/qeventdispatcher_unix.cpp:572
#26 0x033fd0e0 in timerSourceDispatch (source=0x9d9f968) at kernel/qeventdispatcher_glib.cpp:165
#27 0x05301e88 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#28 0x05305730 in ?? () from /lib/libglib-2.0.so.0
#29 0x05305863 in g_main_context_iteration () from /lib/libglib-2.0.so.0
#30 0x033fd02c in QEventDispatcherGlib::processEvents (this=0x9d6da78, flags=...) at kernel/qeventdispatcher_glib.cpp:327
#31 0x01bd2be5 in QGuiEventDispatcherGlib::processEvents (this=0x9d6da78, flags=...) at kernel/qguieventdispatcher_glib.cpp:202
#32 0x033d0c79 in QEventLoop::processEvents (this=0xbfaecea4, flags=) at kernel/qeventloop.cpp:149
#33 0x033d10ca in QEventLoop::exec (this=0xbfaecea4, flags=...) at kernel/qeventloop.cpp:201
#34 0x033d353f in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#35 0x01b31dd7 in QApplication::exec () at kernel/qapplication.cpp:3525
#36 0x080a4e09 in main (argc=5, argv=0xbfaed354) at /build/buildd/konversation-1.2/src/main.cpp:98

I think it's probably the same bug because the backtrace is similar to those in duplicates of this bug (such as bug 225690), and the only unusual thing I noticed was that someone had just pasted a bunch of unusual characters to the channel I was viewing; here's a hexdump of the relevant part of my logs (the channel is publically logged, so this isn't a privacy problem):

00444c40: 7465 3e09 2174 656c 6c20 6772 6565 6e73  te>.!tell greens
00444c50: 6e61 726b 20f0 908c 81f0 908c 84f0 908c  nark ...........
00444c60: b3f0 908c b1f0 908c 98f0 908c 9520 f090  ............. ..
00444c70: 8e81 f090 8e85 f090 8e8c f090 8eb4 f090  ................
00444c80: 8f88 2020 20f0 9d95 8420 f09d 9596 20f0  ..   .... .... .
00444c90: 9d95 a020 f09d 95a8 0a5b 5475 6573 6461  ... .....[Tuesda

It looks from this bug report like you've found the cause already, but I'm attaching this in case it turns out to be helpful.
Comment 28 Eike Hein 2010-03-09 23:45:48 UTC
Yeah, it's fixed as of Konversation 1.2.3.
Comment 29 Dario Andres 2010-03-23 12:48:15 UTC
- Should this be marked as fixed (considering the in-house fix on Konversation) and leave bug 199485 opened (for a global fix) ?
Comment 30 Eike Hein 2010-03-23 12:52:44 UTC
Sounds ok.