Bug 127749

Summary: kopete freezes on desktop right click
Product: [Unmaintained] kopete Reporter: marseillai <cyrilb856>
Component: generalAssignee: Kopete Developers <kopete-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: Daniel.Frein, dpbasti, gmludo, judecn, kde-bugs, marnold, ron.eggler
Priority: NOR    
Version: 0.11.1   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description marseillai 2006-05-21 10:27:10 UTC
Version:           0.11.1 (using KDE KDE 3.5.2)
Installed from:    Ubuntu Packages
OS:                Linux

When i make a right click on my desktop when my usb HD is sleeping, kde freeze and my usb HD wakes up. Then killing kopete unfreeze my kde.

this bug is a replacement for this one : http://bugs.kde.org/show_bug.cgi?id=124670
Comment 1 Carlos Sanchis 2006-05-26 09:52:30 UTC
I have the same problem too. I'm using KDE 3.5.2 (SuSE rpms), but it happened with older versions of Kopete and KDE too. Not only is the desktop frozen (no context menus etc.), but also the keyboard: it can't send any input to any app. Strangely enough, the mouse is not affected and the only way I find to work this around is opening ksysguard from the kmenu and killing kopete. Then everything works again and all the actions I did in the meantime seem to have effect one by one, as if they were in a queue (clicking here, there... pressing CONTROL+ALT+DEL...).
Comment 2 Carlos Sanchis 2006-05-26 10:30:57 UTC
I think this is not exactly a crash but a freeze, if that helps.
Comment 3 Philip Rodrigues 2006-06-03 13:14:51 UTC
Presumably the same as bug 125035
Comment 4 Daniel Frein 2006-06-03 13:57:49 UTC
just for the sake of completeness: http://bugs.kde.org/show_bug.cgi?id=125035 describes the same bug
Comment 5 Dik Takken 2006-06-03 14:37:19 UTC
*** Bug 125035 has been marked as a duplicate of this bug. ***
Comment 6 Dik Takken 2006-06-03 14:40:03 UTC
Bug 125035 contains backtraces of Kopete when it freezes.

I guess _this_ bug should be confirmed and possibly get a higher severity settings, as it freezes large parts of KDE.
Comment 7 Daniel Frein 2006-06-03 18:54:09 UTC
*** This bug has been confirmed by popular vote. ***
Comment 8 K. Hauser 2006-06-04 10:35:58 UTC
Using Ubuntu 5.10/KDE 3.5.2 and Ubuntu 6.06/KDE 3.5.3...

While using Kopete chat window, trying to right-click an icon on desktop will freeze almost everything... other (non-Kopete-related) windows that are already open seem to work... all other desktop functionality "frozen" until Kopete is killed...  although desktop is frozen, will "queue up" commands given... when Kopete is killed, all commands will then execute.

Cannot reproduce bug and seems to happen sparingly and at random... seems to happen when I already have text written, but not submitted, and waiting after a short period... possibly something to do with how the MSN protocol times out?
Comment 9 marseillai 2006-06-04 11:45:14 UTC
I launched kopete with : kopete --nofork then wait the crash. then i 
"run gdb kopete `pidof kopete`" and i got this backtrace :
(gdb) bt
#0  0xffffe410 in __kernel_vsyscall ()
#1  0x4cf5556b in __read_nocancel () from /lib/tls/i686/cmov/libpthread.so.0
#2  0x4fe06a71 in _kde_IceTransFreeConnInfo () from /usr/lib/libDCOP.so.4
#3  0x4fe06e41 in _kde_IceTransRead () from /usr/lib/libDCOP.so.4
#4  0x4fdffb95 in _kde_IceRead () from /usr/lib/libDCOP.so.4
#5  0x4fe00149 in KDE_IceProcessMessages () from /usr/lib/libDCOP.so.4
#6  0x4fdf4cf8 in DCOPClient::callInternal () from /usr/lib/libDCOP.so.4
#7  0x4fdf4f24 in DCOPClient::callInternal () from /usr/lib/libDCOP.so.4
#8  0x4fdf5540 in DCOPClient::call () from /usr/lib/libDCOP.so.4
#9  0x4fdf71f8 in DCOPRef::callInternal () from /usr/lib/libDCOP.so.4
#10 0x4fdf7300 in DCOPRef::callInternal () from /usr/lib/libDCOP.so.4
#11 0x41f00803 in Kopete::Away::slotTimerTimeout () from /usr/lib/libkopete.so.1
#12 0x41f00a36 in Kopete::Away::qt_invoke () from /usr/lib/libkopete.so.1
#13 0x4d6db3c9 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#14 0x4d6dbe64 in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#15 0x4da704be in QTimer::timeout () from /usr/lib/libqt-mt.so.3
---Type <return> to continue, or q <return> to quit---
#16 0x4d7003c1 in QTimer::event () from /usr/lib/libqt-mt.so.3
#17 0x4d671366 in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#18 0x4d671562 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#19 0x4ff99f11 in KApplication::notify () from /usr/lib/libkdecore.so.4
#20 0x4d60268f in QApplication::sendEvent () from /usr/lib/libqt-mt.so.3
#21 0x4d662d53 in QEventLoop::activateTimers () from /usr/lib/libqt-mt.so.3
#22 0x4d61649f in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#23 0x4d689e57 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#24 0x4d689d7a in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#25 0x4d66fe75 in QApplication::exec () from /usr/lib/libqt-mt.so.3
#26 0x08078c52 in ?? ()
#27 0xbf9b8200 in ?? ()
#28 0xbf9b8334 in ?? ()
#29 0xbf9b832c in ?? ()
#30 0x00000000 in ?? ()

so it seems that the problem is in Kopete::Away::slotTimerTimeout ()

if it can helps the bug occurs only if my usb hard drive is plugged and is sleeping.
Comment 10 Philip Rodrigues 2006-06-04 14:16:38 UTC
Kopete::Away::slotTimerTimeout calls the DCOP function kdesktop->KScreensaverIface->isBlanked, so perhaps the following might be useful to try:

1. Run "kdcop"
2. In the treeview, open kdesktop->KScreensaverIface
3. Double-click on "bool isBlanked".

What result do you get?
Comment 11 marseillai 2006-06-04 14:18:12 UTC
isBlanked is set to "false"
Comment 12 GML 2006-06-04 14:46:40 UTC
I've the same result in kdcop.
Comment 13 Philip Rodrigues 2006-06-04 17:52:55 UTC
OK. I thought perhaps the DCOP call itself was causing the freeze, but that doesn't seem to be the case.
Comment 14 jaguarwan 2006-06-06 00:53:22 UTC
Hello,

I have the same problem with Kdesktop and Kopete 0.11.3 from KDE 3.5.3 :)

I can reliably trigger this bug by repeatedly right clicking on the mount point icon of my USB hard drive and on the desktop.

This both freeze kdesktop and kopete. Killing either kdesktop or kopete allows to recover full functionnality.

I made those two backtraces:

KDESKTOP:
(no debugging symbols found)
0xa6bea22e in __read_nocancel () from /lib/tls/libpthread.so.0
#0  0xa6bea22e in __read_nocancel () from /lib/tls/libpthread.so.0
#1  0xa76b3dce in _kde_IceTransFreeConnInfo () from /opt/kde/lib/libDCOP.so.4
#2  0xa76b421f in _kde_IceTransRead () from /opt/kde/lib/libDCOP.so.4
#3  0xa76acabc in _kde_IceRead () from /opt/kde/lib/libDCOP.so.4
#4  0xa76ad0e7 in KDE_IceProcessMessages () from /opt/kde/lib/libDCOP.so.4
#5  0xa769c020 in DCOPClient::callInternal () from /opt/kde/lib/libDCOP.so.4
#6  0xa769c611 in DCOPClient::callInternal () from /opt/kde/lib/libDCOP.so.4
#7  0xa76a0f5c in DCOPClient::call () from /opt/kde/lib/libDCOP.so.4
#8  0xa76a0fc8 in DCOPClient::call () from /opt/kde/lib/libDCOP.so.4
#9  0xa53fffad in KIMIface_stub::fileTransferContacts () from /opt/kde/lib/libkimproxy.so.0
#10 0xa53fa8ba in KIMProxy::fileTransferContacts () from /opt/kde/lib/libkimproxy.so.0
#11 0xa5626f8d in KMetaMenu::KMetaMenu () from /opt/kde/lib/kde3/libkuickplugin.so
#12 0xa56221ed in KTestMenu::slotPrepareMenu () from /opt/kde/lib/kde3/libkuickplugin.so
#13 0xa5622950 in KTestMenu::qt_invoke () from /opt/kde/lib/kde3/libkuickplugin.so
#14 0xa7169d34 in QObject::activate_signal () from /usr/lib/qt/lib/libqt-mt.so.3
#15 0xa716a4cc in QObject::activate_signal () from /usr/lib/qt/lib/libqt-mt.so.3
#16 0xa74bfa9c in QPopupMenu::aboutToShow () from /usr/lib/qt/lib/libqt-mt.so.3
#17 0xa727d039 in QPopupMenu::popup () from /usr/lib/qt/lib/libqt-mt.so.3
#18 0xa728045f in QPopupMenu::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#19 0xa676b64c in KDIconView::popupMenu () from /opt/kde/lib/libkdeinit_kdesktop.so
#20 0xa676b80a in KDIconView::slotContextMenuRequested () from /opt/kde/lib/libkdeinit_kdesktop.so
#21 0xa676edc7 in KDIconView::qt_invoke () from /opt/kde/lib/libkdeinit_kdesktop.so
#22 0xa7169d34 in QObject::activate_signal () from /usr/lib/qt/lib/libqt-mt.so.3
#23 0xa74d6d69 in QIconView::contextMenuRequested () from /usr/lib/qt/lib/libqt-mt.so.3
#24 0xa7346c55 in QIconView::contentsContextMenuEvent () from /usr/lib/qt/lib/libqt-mt.so.3
#25 0xa72892e5 in QScrollView::viewportContextMenuEvent () from /usr/lib/qt/lib/libqt-mt.so.3
#26 0xa728b319 in QScrollView::eventFilter () from /usr/lib/qt/lib/libqt-mt.so.3
#27 0xa733e7ef in QIconView::eventFilter () from /usr/lib/qt/lib/libqt-mt.so.3
#28 0xa71670bf in QObject::activate_filters () from /usr/lib/qt/lib/libqt-mt.so.3
#29 0xa7167194 in QObject::event () from /usr/lib/qt/lib/libqt-mt.so.3
#30 0xa71a350f in QWidget::event () from /usr/lib/qt/lib/libqt-mt.so.3
#31 0xa710522f in QApplication::internalNotify () from /usr/lib/qt/lib/libqt-mt.so.3
#32 0xa710568e in QApplication::notify () from /usr/lib/qt/lib/libqt-mt.so.3
#33 0xa77749f5 in KApplication::notify () from /opt/kde/lib/libkdecore.so.4
#34 0xa709f7a2 in QETWidget::translateMouseEvent () from /usr/lib/qt/lib/libqt-mt.so.3
#35 0xa709d821 in QApplication::x11ProcessEvent () from /usr/lib/qt/lib/libqt-mt.so.3
#36 0xa70b0f25 in QEventLoop::processEvents () from /usr/lib/qt/lib/libqt-mt.so.3
#37 0xa711b951 in QEventLoop::enterLoop () from /usr/lib/qt/lib/libqt-mt.so.3
#38 0xa711b8a6 in QEventLoop::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#39 0xa710438f in QApplication::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#40 0xa675e9ca in kdemain () from /opt/kde/lib/libkdeinit_kdesktop.so
#41 0xa76727e4 in kdeinitmain () from /opt/kde/lib/kde3/kdesktop.so
#42 0x0804e4b4 in ?? ()
#43 0x00000001 in ?? ()
#44 0x080ed980 in ?? ()
#45 0x00000001 in ?? ()
#46 0x00000000 in ?? ()

KOPETE:
(no debugging symbols found)
0xa63c4251 in __read_nocancel () from /lib/tls/libpthread.so.0
#0  0xa63c4251 in __read_nocancel () from /lib/tls/libpthread.so.0
#1  0xa6e65dce in _kde_IceTransFreeConnInfo () from /opt/kde/lib/libDCOP.so.4
#2  0xa6e6621f in _kde_IceTransRead () from /opt/kde/lib/libDCOP.so.4
#3  0xa6e5eabc in _kde_IceRead () from /opt/kde/lib/libDCOP.so.4
#4  0xa6e5f0e7 in KDE_IceProcessMessages () from /opt/kde/lib/libDCOP.so.4
#5  0xa6e4e020 in DCOPClient::callInternal () from /opt/kde/lib/libDCOP.so.4
#6  0xa6e4e611 in DCOPClient::callInternal () from /opt/kde/lib/libDCOP.so.4
#7  0xa6e52f5c in DCOPClient::call () from /opt/kde/lib/libDCOP.so.4
#8  0xa6e48f01 in DCOPRef::callInternal () from /opt/kde/lib/libDCOP.so.4
#9  0xa6e4901d in DCOPRef::callInternal () from /opt/kde/lib/libDCOP.so.4
#10 0xa7f001e5 in Kopete::Away::slotTimerTimeout () from /opt/kde/lib/libkopete.so.1
#11 0xa7f0047c in Kopete::Away::qt_invoke () from /opt/kde/lib/libkopete.so.1
#12 0xa693fd34 in QObject::activate_signal () from /usr/lib/qt/lib/libqt-mt.so.3
#13 0xa69404cc in QObject::activate_signal () from /usr/lib/qt/lib/libqt-mt.so.3
#14 0xa6c819e9 in QTimer::timeout () from /usr/lib/qt/lib/libqt-mt.so.3
#15 0xa696200f in QTimer::event () from /usr/lib/qt/lib/libqt-mt.so.3
#16 0xa68db22f in QApplication::internalNotify () from /usr/lib/qt/lib/libqt-mt.so.3
#17 0xa68db3cc in QApplication::notify () from /usr/lib/qt/lib/libqt-mt.so.3
#18 0xa6f259f5 in KApplication::notify () from /opt/kde/lib/libkdecore.so.4
#19 0xa68ce78c in QEventLoop::activateTimers () from /usr/lib/qt/lib/libqt-mt.so.3
#20 0xa68874d1 in QEventLoop::processEvents () from /usr/lib/qt/lib/libqt-mt.so.3
#21 0xa68f1951 in QEventLoop::enterLoop () from /usr/lib/qt/lib/libqt-mt.so.3
#22 0xa68f18a6 in QEventLoop::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#23 0xa68da38f in QApplication::exec () from /usr/lib/qt/lib/libqt-mt.so.3
#24 0x0806da13 in ?? ()
#25 0xafcbaf60 in ?? ()
#26 0xafcbaf40 in ?? ()
#27 0xafcbaf40 in ?? ()
#28 0x00000000 in ?? ()

I wrongly filed a bug entry in the kdesktop section the other day, you can check it for further details (and mark it as a dupe of this one): http://bugs.kde.org/show_bug.cgi?id=128163

Thank you very much, and have a nice day :)
Comment 15 jaguarwan 2006-06-07 10:03:17 UTC
Hello,

I investigated the issue and it appears to be related to a circular call.

KDesktop tries to fetch the contacts to fill the context menu of the mount point icon (Copy To > Contact) via KIMProxy while Kopete is calling KDesktop to know if the screensaver is set. The two wait after each other reply and get stuck.

Simply disabling the autoaway feature should fix that for those who want an immediate solution, and I have done this little patch which seems to fix the bug on my setup (against the 0.12 source code).

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

--- kopeteaway.cpp.orig 2006-05-31 02:24:05.000000000 +0200
+++ kopeteaway.cpp      2006-06-07 05:52:15.000000000 +0200
@@ -326,8 +326,11 @@
        // the cleaner wiping the keyboard :).

        DCOPRef screenSaver("kdesktop", "KScreensaverIface");
-       DCOPReply isBlanked = screenSaver.call("isBlanked");
-       if (!(isBlanked.isValid() && isBlanked.type == "bool" && ((bool)isBlanked)))
+
+    /* should be able to respond to KDesktop queries to avoid a deadlock */
+       DCOPReply isBlanked = screenSaver.callExt("isBlanked", DCOPRef::NoEventLoop, 10);
+
+    if (!(isBlanked.isValid() && isBlanked.type == "bool" && ((bool)isBlanked)))
        {
                // DCOP failed, or returned something odd, or the screensaver is
                // inactive, so check for activity the X11 way.  It's only worth

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

This simply add a 10ms timeout to prevent Kopete from getting stuck in the dcop call. I thought dcop had a builtin circular call prevention mechanism ?

Hope this helps and have a nice day :)

Best regards.
Comment 16 Olivier Goffart 2006-06-07 18:06:57 UTC
SVN commit 549156 by ogoffart:

Fix Bug 127749: kopete freezes on desktop right click

BUG: 127749

I've taken the patch from jaguarwan, and added some check to assure good reentrency due to the call to the evebt loop.
Please have a test.


 M  +13 -2     kopeteaway.cpp  


--- branches/kopete/0.12/kopete/libkopete/kopeteaway.cpp #549155:549156
@@ -198,6 +198,8 @@
 
 Kopete::Away::~Away()
 {
+	if(this == instance)
+		instance = 0L;	
 	delete d;
 }
 
@@ -324,9 +326,18 @@
 	// isn't blanked/locked, because activity while blanked is impossible and
 	// activity while locked never matters (if there is any, it's probably just
 	// the cleaner wiping the keyboard :).
-
+	
+	
+	/* we should be able to respond to KDesktop queries to avoid a deadlock, so we allow the event loop to be called */
+	static bool rentrency_protection=false;
+	if(rentrency_protection)
+		return;
+	rentrency_protection=true;
 	DCOPRef screenSaver("kdesktop", "KScreensaverIface");
-	DCOPReply isBlanked = screenSaver.call("isBlanked");
+	DCOPReply isBlanked = screenSaver.callExt("isBlanked" ,  DCOPRef::UseEventLoop, 10);
+	rentrency_protection=false;
+	if(!instance) //this may have been deleted in the event loop
+		return;
 	if (!(isBlanked.isValid() && isBlanked.type == "bool" && ((bool)isBlanked)))
 	{
 		// DCOP failed, or returned something odd, or the screensaver is
Comment 17 jaguarwan 2006-06-07 19:07:53 UTC
I applied your patch and it works like a charm :)

Thank you very much :D
Comment 18 GML 2006-06-07 20:51:20 UTC
YEEEAAAAAAHHHHHHH !!!!! thank you very much !!!
I love Free Software and KDE :-) This bug it's real problem for me all days.
Thank you for your work around KDE.
Comment 19 Olivier Goffart 2006-06-07 21:34:07 UTC
*** Bug 128495 has been marked as a duplicate of this bug. ***
Comment 20 ekaitza 2006-06-18 13:04:00 UTC
Anyone could explain what to do with this patch??
I'm newbie and can understand how to fix this bug using the patch.
Thank you!
Comment 21 jaguarwan 2006-06-18 14:47:52 UTC
If you don't feel like recompiling kopete, simply disable the auto away option.

Otherwise, here is a slackbuild to compile kopete with this patch:
http://mammouth.tuxfamily.org/slackware/kopete-0.12.0-slackbuild/

Simply download the files, exec the script and pray it works on your particular distro.
Comment 22 ekaitza 2006-06-18 15:23:35 UTC
Thanx, i'll try disabling auto away first.
Comment 23 Olivier Goffart 2006-06-20 12:04:35 UTC
*** Bug 129465 has been marked as a duplicate of this bug. ***
Comment 24 Carlos Sanchis 2006-07-07 11:21:56 UTC
I have the auto-away feature disabled and still no luck.
Comment 25 Matthew Arnold 2006-08-02 04:42:44 UTC
I have auto-away disabled as well and still experience this problem.
Comment 26 Matthew Arnold 2006-08-02 04:44:05 UTC
I should add that this is in Slackware 10.2 with the unsupported KDE 3.5.3 packages.
Comment 27 Ron Eggler 2006-08-02 06:28:17 UTC
Go 'n get the svn version and you won't have this problem again!
see and install like described on: http://wiki.kde.org/tiki-index.php?page=Kopete%20SVN
Comment 28 Philip Rodrigues 2006-09-06 13:15:40 UTC
*** Bug 130288 has been marked as a duplicate of this bug. ***
Comment 29 Pascal Hofmann 2006-09-27 07:59:03 UTC
Disabling auto-away does not fix this problem for me. (KDE 3.5.2, Kopete 0.11.1 on gentoo)
Comment 30 bernst3 2006-10-15 16:58:29 UTC
I've been receiving the same issue with the CD-ROM mount icon on kde 3.5.4 and kopete 0.11.3.

I do not have auto-away enabled in kopete.

This bug shows resolved, what version was the fix applied in?
Comment 31 Philip Rodrigues 2007-01-30 19:48:09 UTC
*** Bug 135608 has been marked as a duplicate of this bug. ***