Bug 177487

Summary: logging on with bonjour crashes kopete
Product: [Unmaintained] kopete Reporter: Børre Gaup <albbas>
Component: Bonjour PluginAssignee: Kopete Developers <kopete-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: anselmolsm, bammbr, inakiibarrola, johann-nikolaus, magnus.bergmark, sebastian, sputnick, tejasdinkar
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Backtrace of the crash
Console output of kopete
New crash log
Crash log from the kopete version with Tejas Dinkars changes attached
Crash log from the kopete version packaged for Kubuntu
trace on patched kde4.3rc2

Description Børre Gaup 2008-12-11 13:31:45 UTC
Version:           4:4.1.80-0ubuntu2~intrepid1~ppa1 (using Devel)
Compiler:          gcc version 4.3.2 (Ubuntu 4.3.2-1ubuntu11)  
OS:                Linux
Installed from:    Compiled sources

I added a bonjour account. After a while kopete crashed. Restarting kopete results in a crash when the bonjour attempts to start.
Comment 1 Børre Gaup 2008-12-11 13:33:39 UTC
Created attachment 29238 [details]
Backtrace of the crash
Comment 2 Børre Gaup 2008-12-11 13:35:56 UTC
Created attachment 29239 [details]
Console output of kopete
Comment 3 Tejas Dinkar 2008-12-11 16:33:42 UTC
SVN commit 895734 by dinkar:

My Hunch is that BUG 177487 is caused by services that won't resolve
CCBUG: 177487

 M  +24 -13    bonjouraccount.cpp  
 M  +5 -4      bonjourcontact.cpp  
 M  +2 -1      bonjourcontact.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=895734
Comment 4 Tejas Dinkar 2008-12-11 16:36:49 UTC
My Hunch is that the crash was caused due to unresolvable services (on a large network)

I had faced this bug before, but if I tried to connect 3-4 times, it stopped crashing, and I was unable to reproduce since then.

Could you tell me if this is commit did, in fact solve the problem for you?
Comment 5 Børre Gaup 2008-12-12 01:17:47 UTC
I copied the files found at http://websvn.kde.org/?view=rev&revision=895734
into the directory structure and got these compilation errors:

In file included from /home/boerre/src/kdenetwork-4.1.80.changed/kopete/protocols/bonjour/bonjouraccount.h:30,
                 from /home/boerre/src/kdenetwork-4.1.80.changed/kopete/protocols/bonjour/bonjouraccount.cpp:18:
/home/boerre/src/kdenetwork-4.1.80.changed/kopete/libkopete/kopetecontact.h:236: warning: ‘virtual QList<KAction*>* Kopete::Contact::customContextMenuActions(Kopete::ChatSession*)’ was hidden
/home/boerre/src/kdenetwork-4.1.80.changed/kopete/protocols/bonjour/bonjourcontact.h:80: warning:   by ‘virtual QList<KAction*>* BonjourContact::customContextMenuActions()’
/home/boerre/src/kdenetwork-4.1.80.changed/kopete/protocols/bonjour/bonjouraccount.cpp: In member function ‘void BonjourAccount::startPublish()’:
/home/boerre/src/kdenetwork-4.1.80.changed/kopete/protocols/bonjour/bonjouraccount.cpp:161: error: ‘getLocalHostName’ is not a member of ‘DNSSD::ServiceBrowser’
/home/boerre/src/kdenetwork-4.1.80.changed/kopete/protocols/bonjour/bonjouraccount.cpp: In member function ‘void BonjourAccount::comingOnline(KSharedPtr<DNSSD::RemoteService>)’:
/home/boerre/src/kdenetwork-4.1.80.changed/kopete/protocols/bonjour/bonjouraccount.cpp:246: error: ‘resolveHostName’ is not a member of ‘DNSSD::ServiceBrowser’
make[2]: *** [kopete/protocols/bonjour/CMakeFiles/kopete_bonjour.dir/bonjouraccount.o] Error 1
make[2]: Leaving directory `/home/boerre/src/kdenetwork-4.1.80.changed/obj-i486-linux-gnu'
make[1]: *** [kopete/protocols/bonjour/CMakeFiles/kopete_bonjour.dir/all] Error 2
make[1]: Leaving directory `/home/boerre/src/kdenetwork-4.1.80.changed/obj-i486-linux-gnu'
make: *** [all] Error 2
Comment 6 Tejas Dinkar 2008-12-12 04:31:03 UTC
Erm, sorry. I had assumed you were using trunk.

The functions DNSSD::ServiceBroswer::resolveHostName and DNSSD::ServiceBroswer::getLocalHostName got moved there only recently. (post 4.1.80).

Tell you what, I maintain a tree of this for the fedora project (which does NOT use these recent features of DNSSD). You can get the tarball here
http://tejas.fedorapeople.org/fedora-review/bonjour.tar.gz

It is a snapshot of trunk with all those dnssd patches reverted. Do NOT, however, use the CMakeLists.txt from this tarball. (This build is for making a stand alone plugin).

Could you try using the files from here? (strictly, you will need to replace bonjourcontact.cpp, bonjouraccount.h & cpp and make sure avahi-bonjour.cpp is in your current folder)
Comment 7 Børre Gaup 2008-12-12 14:33:37 UTC
Created attachment 29267 [details]
New crash log

Fetched the tar ball mentioned in comment #6, moved everything but the CMakeLists.txt files into the the original 4.1.80 directory, made new packages, installed them and ran kopete. Sadly it crashed :(
Comment 8 Børre Gaup 2008-12-12 15:20:02 UTC
I tried to start this version of kopete a second time, and then bonjour worked as it was supposed to. No crashes, a few minutes after I started.
I also started kopete with other users on the same machine, added a bonjour account and no crashes for those users either.
Comment 9 Børre Gaup 2008-12-12 15:21:55 UTC
I also installed the original kopete package again, and no crashes with that either ...
Comment 10 Tejas Dinkar 2008-12-12 16:13:47 UTC
Yeah, as I said. I faced this bug before, and this happened to me also.

This happened to me at the event FOSS.IN when there was a huge number of people on bonjour.

Is there some client that is causing this (somewhere else on the network)?

I'm leaving this bug open. Until I can figure out what's wrong.

Glad it works, and I have someone using the code though :). This is the first bonjour bug (not filed by me :)
Comment 11 Børre Gaup 2008-12-15 10:34:33 UTC
When I started kopete today it crashed again. 
It happened consistantly when a collegue of mine were logged on, and he is connected to our network through a hub (not a switch).
When he logged off, the bonjour plugin worked as it should. When he logged on again (this time kopete was up and running) kopete crashed. This happened with both your changes and the original 4.1.80 kubuntu package. I'm adding the crash logs from both kopete versions.
Comment 12 Børre Gaup 2008-12-15 10:37:56 UTC
Created attachment 29352 [details]
Crash log from the kopete version with Tejas Dinkars changes attached
Comment 13 Børre Gaup 2008-12-15 10:38:51 UTC
Created attachment 29353 [details]
Crash log from the kopete version packaged for Kubuntu
Comment 14 Tejas Dinkar 2008-12-15 11:50:50 UTC
What instant messenger is he using? Pidgin? Kopete?

Also, can you tell me what hostname he has, and any other details?

This seems more and more like a bug in Qt.

Could you install the debugging packages for qt, and try to give me another backtrace (with either install)?
Comment 15 Manuel Nickschas 2009-02-05 11:46:16 UTC
I can reproduce this with current trunk. Backtrace looks mostly identical, but there is no setRemoteHostName() in mine.

In my case, it is clearly caused by a single client coming online. We are testing this out in our office, and there is only two Linux boxen and a Windows box connected. As soon as the Windows box goes online (he uses Pidgin on both Windows XP and 7), both Kopete instances crash instantly. This can be reproduced every time - both Kopete instance see each other fine, but as soon as Pidgin/Windows goes online, they crash. There is no other machines involved.

Output follows:

-------8<---------------------------------------------------------------

kopete(18555) DNSSD::RemoteService::resolveAsync: DNSSD::RemoteService(0x3307c30) :Starting resolve of :  "phon@little-aeffle"   "_presence._tcp"   "local"                                                                                                                                         

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f4086e74750 (LWP 18555)]
0x00007f4083098550 in QString::operator= () from /usr/lib64/qt4/libQtCore.so.4
(gdb) bt
#0  0x00007f4083098550 in QString::operator= () from /usr/lib64/qt4/libQtCore.so.4
#1  0x00007f40843beaab in QHostAddress::operator= () from /usr/lib64/qt4/libQtNetwork.so.4
#2  0x00007f406f94b21c in BonjourAccount::comingOnline (this=0x2a00530, pointer={d = 0x7fff8eebb070})
    at /var/tmp/portage/kde-base/kopete-9999/work/kopete-9999/kopete/protocols/bonjour/bonjouraccount.cpp:259
#3  0x00007f406f94b6bc in BonjourAccount::qt_metacall (this=0x2a00530, _c=<value optimized out>, _id=<value optimized out>, _a=0x7fff8eebb180)
    at /var/tmp/portage/kde-base/kopete-9999/work/kopete_build/kopete/protocols/bonjour/bonjouraccount.moc:93
#4  0x00007f4083153644 in QMetaObject::activate () from /usr/lib64/qt4/libQtCore.so.4
#5  0x00007f406f4fcf32 in DNSSD::ServiceBrowser::serviceAdded () from /usr/kde/live/lib64/libkdnssd.so.4
#6  0x00007f406f4fdd4c in DNSSD::ServiceBrowserPrivate::gotNewService () from /usr/kde/live/lib64/libkdnssd.so.4
#7  0x00007f406f4fdf01 in DNSSD::ServiceBrowserPrivate::qt_metacall () from /usr/kde/live/lib64/libkdnssd.so.4
#8  0x00007f4083153644 in QMetaObject::activate () from /usr/lib64/qt4/libQtCore.so.4
#9  0x00007f406f50b588 in OrgFreedesktopAvahiServiceBrowserInterface::ItemNew () from /usr/kde/live/lib64/libkdnssd.so.4
#10 0x00007f406f50b827 in OrgFreedesktopAvahiServiceBrowserInterface::qt_metacall () from /usr/kde/live/lib64/libkdnssd.so.4
#11 0x00007f4083449013 in QDBusConnectionPrivate::deliverCall () from /usr/lib64/qt4/libQtDBus.so.4
#12 0x00007f40834501df in QDBusCallDeliveryEvent::placeMetaCall () from /usr/lib64/qt4/libQtDBus.so.4
#13 0x00007f408314e315 in QObject::event () from /usr/lib64/qt4/libQtCore.so.4
#14 0x00007f4082214b8d in QApplicationPrivate::notify_helper () from /usr/lib64/qt4/libQtGui.so.4
#15 0x00007f408221c8da in QApplication::notify () from /usr/lib64/qt4/libQtGui.so.4
#16 0x00007f4083d14e0b in KApplication::notify () from /usr/kde/live/lib64/libkdeui.so.5
#17 0x00007f408313f400 in QCoreApplication::notifyInternal () from /usr/lib64/qt4/libQtCore.so.4
#18 0x00007f40831400a1 in QCoreApplicationPrivate::sendPostedEvents () from /usr/lib64/qt4/libQtCore.so.4
#19 0x00007f40831678f3 in postEventSourceDispatch () from /usr/lib64/qt4/libQtCore.so.4
#20 0x00007f407de866f1 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#21 0x00007f407de89e6d in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#22 0x00007f407de8a02b in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#23 0x00007f408316757f in QEventDispatcherGlib::processEvents () from /usr/lib64/qt4/libQtCore.so.4
#24 0x00007f40822a4b9f in QGuiEventDispatcherGlib::processEvents () from /usr/lib64/qt4/libQtGui.so.4
#25 0x00007f408313dd22 in QEventLoop::processEvents () from /usr/lib64/qt4/libQtCore.so.4
#26 0x00007f408313dead in QEventLoop::exec () from /usr/lib64/qt4/libQtCore.so.4
#27 0x00007f408314035d in QCoreApplication::exec () from /usr/lib64/qt4/libQtCore.so.4
#28 0x0000000000446bfc in main (argc=2, argv=0x7fff8eebcee8) at /var/tmp/portage/kde-base/kopete-9999/work/kopete-9999/kopete/kopete/main.cpp:104
Comment 16 Manuel Nickschas 2009-02-05 12:15:42 UTC
Relevant parts with a debug-enabled Qt. This is qt-copy as of today.

#0  QString::operator= (this=0x1374728, other=@0x1316978) at ../../include/QtCore/../../src/corelib/arch/qatomic_x86_64.h:129
#1  0x00007ff54a471feb in QHostAddress::operator= (this=0x1547308, address=<value optimized out>) at kernel/qhostaddress.cpp:100
#2  0x00007ff53617921c in BonjourAccount::comingOnline (this=0x1bdfdf0, pointer={d = 0x7fff54f71110})
    at /var/tmp/portage/kde-base/kopete-9999/work/kopete-9999/kopete/protocols/bonjour/bonjouraccount.cpp:259
#3  0x00007ff5361796bc in BonjourAccount::qt_metacall (this=0x1bdfdf0, _c=<value optimized out>, _id=<value optimized out>, _a=0x7fff54f71230)
    at /var/tmp/portage/kde-base/kopete-9999/work/kopete_build/kopete/protocols/bonjour/bonjouraccount.moc:93
#4  0x00007ff5491fd87c in QMetaObject::activate (sender=0x1be03a0, from_signal_index=<value optimized out>, to_signal_index=4, argv=0x0)
    at kernel/qobject.cpp:3031
#5  0x00007ff535d2af32 in DNSSD::ServiceBrowser::serviceAdded () from /usr/kde/live/lib64/libkdnssd.so.4
#6  0x00007ff535d2bd4c in DNSSD::ServiceBrowserPrivate::gotNewService () from /usr/kde/live/lib64/libkdnssd.so.4
#7  0x00007ff535d2bf01 in DNSSD::ServiceBrowserPrivate::qt_metacall () from /usr/kde/live/lib64/libkdnssd.so.4
#8  0x00007ff5491fd87c in QMetaObject::activate (sender=0x1523590, from_signal_index=<value optimized out>, to_signal_index=8, argv=0x0)
    at kernel/qobject.cpp:3031
#9  0x00007ff535d39588 in OrgFreedesktopAvahiServiceBrowserInterface::ItemNew () from /usr/kde/live/lib64/libkdnssd.so.4
#10 0x00007ff535d39827 in OrgFreedesktopAvahiServiceBrowserInterface::qt_metacall () from /usr/kde/live/lib64/libkdnssd.so.4
Comment 17 Børre Gaup 2009-05-11 17:30:58 UTC
Kopete stills crashes for me.
We are seven collegues on the same net, the others use iChat on Leopard.
The crash only happens when one particular collegue is logged on to his bonjour account.
Comment 18 Børre Gaup 2009-05-11 17:41:38 UTC
Could it be that there is some problem with the glib event loop? 
I read a blog a year ago where a KDE developer had had a problem with that.

By the way, the version info for kopete is:

kopete -v
Qt: 4.5.1
KDE: 4.2.3 (KDE 4.2.3)
Kopete: 0.70.2
Comment 19 Tejas Dinkar 2009-07-21 08:26:29 UTC
SVN commit 1000243 by dinkar:

Added explicit constructors for objects in classes in Bonjour
This should fix the ugly segfaulting that has been happening for some
people. (see the bug list below).
CCBUG: 177487
CCBUG: 192087

 M  +2 -6      bonjouraccount.cpp  
 M  +6 -5      bonjouraddcontactpage.h  
 M  +2 -19     bonjourcontact.cpp  
 M  +1 -6      bonjourcontact.h  
 M  +2 -4      bonjourcontactconnection.cpp  
 M  +0 -1      bonjoureditaccountwidget.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1000243
Comment 20 Anselmo L. S. Melo (anselmolsm) 2009-07-21 16:51:30 UTC
This bug seems duplicate of bug 192087 [1], but it wasn't marked, as we can read in #2 [2] there.

That bug was marked as FIXED after commit r1000243 and I suppose it also applies to this bug.

[1] https://bugs.kde.org/192087
[2] https://bugs.kde.org/show_bug.cgi?id=192087#c2
Comment 21 Tejas Dinkar 2009-07-21 20:06:34 UTC
This bug IS a duplicate of the other one, but I didn't mark it as such so I'll get motivation  to solve 2 bugs instead of one.

In any case, the other one wasn't marked as fixed, but POTENTIALLY fixed :P. I'll close it if no one else can reproduce a bug in the near future.
Comment 22 Iñaki Ibarrola Atxa 2009-07-22 09:46:11 UTC
Created attachment 35534 [details]
trace on patched kde4.3rc2
Comment 23 Iñaki Ibarrola Atxa 2009-07-22 09:54:29 UTC
The bug still happens here. I have patched 4.3rc2 with the changes on commit #1000243 and Kopete still crashes attemting to connect the bonjour network. I have attached the backtrace.

Other (maybe) useful information:

$ kopete -v
Qt: 4.5.0
KDE: 4.2.96 (KDE 4.2.96 (KDE 4.3 RC2))
Kopete: 0.70.90

$ avahi-browse -rt _presence._tcp
+ eth0 IPv4 david.hidden@DYG                              iChat Presence       local
+ eth0 IPv4 david@pc-dhidden                              iChat Presence       local
+ eth0 IPv4 Iker hidden@ihidden-desktop                   iChat Presence       local
+ eth0 IPv4 david.hidden@david                            iChat Presence       local
= eth0 IPv4 david.hidden@DYG                              iChat Presence       local
   hostname = [DYG.local]
   address = [192.168.5.208]
   port = [5298]
   txt = ["txtvers=1" "1st=Gallego" "last=Gallego" "port.p2pj=5298" "status=avail" "node=libpurple" "ver=2.5.8" "vc=!"]
= eth0 IPv4 david@pc-dhidden                              iChat Presence       local
   hostname = [pc-dhidden.local]
   address = [192.168.5.200]
   port = [5298]
   txt = ["email=david.hidden@hidden.es" "txtvers=1" "msg=♪ Kenji Kawai: Log Off (Avalon) ♪" "1st=David" "port.p2pj=5298" "version=1" "last=hidden Pérez" "jid=david.hidden@pc-dhidden.hidden.hidden.es" "status=avail"]
= eth0 IPv4 Iker hidden@ihidden-desktop                   iChat Presence       local
   hostname = [ihidden-desktop.local]
   address = [192.168.5.17]
   port = [5298]
   txt = ["ver=0.0.1" "vc=!" "txtvers=1" "status=avail" "port.p2pj=5298" "node=kopete" "last=hidden" "email=iker.hidden@hidden.es" "1st=Iker"]
= eth0 IPv4 david.hidden@david                            iChat Presence       local
   hostname = [david.local]
   address = [192.168.5.209]
   port = [5298]
   txt = ["txtvers=1" "1st=David" "last=hidden" "port.p2pj=5298" "status=avail" "node=libpurple" "ver=2.5.8" "vc=!"]
Comment 24 Sebastian Weisgerber 2009-09-15 14:05:26 UTC
Seems that it is a duplicate of #192087
Comment 25 James Hogan 2009-10-12 22:40:45 UTC
SVN commit 1034486 by hogan:

Fix kopete bonjour plugin handling of new contact added to existing metacontact.

When a bonjour contact becomes visible for whom a metacontact already exists, it would try and cast the first contact in the metacontact to BonjourContact even if it was for example a JabberContact, resulting in a segfault.
The fix uses mc->findContact to find the new contact without making assumptions about it's position inside the metacontact.

CCBUG: 177487
CCBUG: 192087

 M  +4 -3      bonjouraccount.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1034486
Comment 26 Roman Jarosz 2010-02-07 15:00:00 UTC
*** Bug 209026 has been marked as a duplicate of this bug. ***
Comment 27 Roman Jarosz 2010-02-07 15:14:56 UTC
*** Bug 223264 has been marked as a duplicate of this bug. ***
Comment 28 Anselmo L. S. Melo (anselmolsm) 2010-07-05 23:21:31 UTC
Ok, closing as FIXED. 
Please reopen if you experience those crashes with KDE SC 4.4+
Thanks
Comment 29 Myriam Schweingruber 2011-12-07 15:19:59 UTC
*** Bug 288225 has been marked as a duplicate of this bug. ***