Bug 112737 - kwin locks up with 99% cpu usage
Summary: kwin locks up with 99% cpu usage
Status: RESOLVED FIXED
Alias: None
Product: kwin
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR crash
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
: 118758 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-09-16 16:43 UTC by Vincenzo Ciancia
Modified: 2006-01-05 10:36 UTC (History)
0 users

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 Vincenzo Ciancia 2005-09-16 16:43:51 UTC
Version:            (using KDE KDE 3.4.2)
Installed from:    Fedora RPMs
OS:                Linux

Well, this is not a crash but it's similar in effect: application can't be used anymore after it. Randomly, but seems when I close the firefox web browser, maybe when I am on a panel icon while closing firefox (and the tooltip for the icon still didn't appear), kwin locks up eating 99% cpu time. 

Keyboard and mouse are locked. I switch to virtual console via chvt bound to my poweroff key via acpid. If I kill kwin I can start new X applications on the same display (not sure if I can start new applications before killing kwin), and old applications do not crash. Besides, I can restart kwin and it won't take 99% cpu anymore. In any case, keyboard and mouse stay grabbed or locked or whatever. I think this may be connected with the rather new elegant tooltips for panel buttons. 

I don't exactly know what to do to produce more information using gdb (also, kwin is not compiled for debug), however maybe a backtrace can help:

(gdb) #0  0x001d249a in NET::typeMatchesMask () from /usr/lib/libkdecore.so.4
#1  0x001d2762 in NETWinInfo::windowType () from /usr/lib/libkdecore.so.4
#2  0x0041a3ea in KWinInternal::Client::windowType ()
   from /usr/lib/libkdeinit_kwin.so
#3  0x0041a717 in KWinInternal::Client::isOverride ()
   from /usr/lib/libkdeinit_kwin.so
#4  0x0041a776 in KWinInternal::Client::wantsTabFocus ()
   from /usr/lib/libkdeinit_kwin.so
#5  0x0042aed2 in KWinInternal::Workspace::CDEWalkThroughWindows ()
   from /usr/lib/libkdeinit_kwin.so
#6  0x0042c062 in KWinInternal::Workspace::slotWalkThroughWindows ()
   from /usr/lib/libkdeinit_kwin.so
#7  0x0041741b in KWinInternal::Workspace::qt_invoke ()
   from /usr/lib/libkdeinit_kwin.so
#8  0x0023c2d4 in KGlobalAccelPrivate::activate ()
   from /usr/lib/libkdecore.so.4
#9  0x0023c727 in KGlobalAccelPrivate::x11KeyPress ()
   from /usr/lib/libkdecore.so.4
#10 0x0023c96b in KGlobalAccelPrivate::x11Event ()
   from /usr/lib/libkdecore.so.4
#11 0x001bd552 in KApplication::x11EventFilter () from /usr/lib/libkdecore.so.4
#12 0x00427422 in KWinInternal::Application::x11EventFilter ()
   from /usr/lib/libkdeinit_kwin.so
#13 0x037cddf1 in qt_set_x11_event_filter ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#14 0x037da984 in QApplication::x11ProcessEvent ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#15 0x037ef008 in QEventLoop::processEvents ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#16 0x0385d78b in QEventLoop::enterLoop ()
   from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#17 0x0385d696 in QEventLoop::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#18 0x03844a99 in QApplication::exec () from /usr/lib/qt-3.3/lib/libqt-mt.so.3
#19 0x004287ef in kdemain () from /usr/lib/libkdeinit_kwin.so
#20 0x0037466c in kdeinitmain () from /usr/lib/kde3/kwin.so
#21 0x0804decd in ?? ()
#22 0x0804e545 in ?? ()
#23 0x0804eb2d in ?? ()
#24 0x0804fba9 in ?? ()
#25 0x00740d5f in __libc_start_main () from /lib/libc.so.6
#26 0x0804b951 in ?? ()
Comment 1 Vincenzo Ciancia 2005-09-19 14:10:46 UTC
I have another backtrace, the only difference is in the first lines:

(gdb) #0  0x0018847b in KWinInternal::Client::windowType ()
   from /usr/lib/libkdeinit_kwin.so
#1  0x001885db in KWinInternal::Client::isDialog ()
   from /usr/lib/libkdeinit_kwin.so
#2  0x00188750 in KWinInternal::Client::wantsTabFocus ()
   from /usr/lib/libkdeinit_kwin.so
#3  0x00198ed2 in KWinInternal::Workspace::CDEWalkThroughWindows ()
   from /usr/lib/libkdeinit_kwin.so
#4  0x0019a062 in KWinInternal::Workspace::slotWalkThroughWindows ()
   from /usr/lib/libkdeinit_kwin.so
#5  0x0018541b in KWinInternal::Workspace::qt_invoke ()

...
Comment 2 Lubos Lunak 2005-09-19 15:57:20 UTC
Both the backtraces clearly show KWin is in code for the Alt+Tab dialog, so they disagree with your description of the problem.
Comment 3 Vincenzo Ciancia 2005-09-19 17:37:48 UTC
Your observation shed more light on the problem. By trying with my alt+tab combination, which is win+tab, I finally discovered a way to reproduce the bug on my system. I often use a single full-screen window per workspace, and I have a combination to close the window, and the bug often manifested after having closed a window, but now I have only been able to reproduce the bug with the alt+tab combination so may be I incidentally press alt+tab (maybe to check if there are other windows below the full-screen one) and do not notice that.

However, to reproduce the bug, I press alt+tab, or win+tab, or whatever key combination I assign to it, and then, even after some time (say 5-6 seconds) I click on the desktop. This triggers the bug. I already tried deactivating khotkeys and also the K menu.
Comment 4 Vincenzo Ciancia 2005-09-19 18:29:52 UTC
WORKAROUND:

The bug does not show if I choose "show window list while switching windows". Also, I found that the bug shows up even in Xnest and that the bug sometimes (but not always) does not show up if I manually start kwin, kicker, kdestkop, korgac, klipper from the command line instead of using startkde.
Comment 5 Vincenzo Ciancia 2005-12-08 11:45:04 UTC
This is a grave bug, leading to the entire computer being unusable in such a way that a normal user can difficultly understand what happened, and I think that this bug should at least be _confirmed_. It's still there in kde 3.5.

It's easy: just go to kcontrol, then

1) Desktop->Window Behaviour->Deselect "Show Window list while switching windows", ok

2) Close all your windows

3) Press ALT+TAB, release alt+tab

4) Click on the empty desktop

In kde 3.5 you can still ctrl+alt+backspace, luckily.

Is it just my problem on three different machines, or is there anyone else who can confirm?
Comment 6 Lubos Lunak 2005-12-14 18:48:27 UTC
SVN commit 488474 by lunakl:

Fix a nasty infinite loop with CDE-style Alt+Tab.
BUG: 112737



 M  +18 -17    tabbox.cpp  


--- branches/KDE/3.5/kdebase/kwin/tabbox.cpp #488473:488474
@@ -932,28 +932,29 @@
         options_traverse_all = KGlobal::config()->readNumEntry("TraverseAll", false );
         }
 
-    if ( !forward )
+    Client* firstClient = 0;
+    do
         {
-        do
+        nc = forward ? nextStaticClient(nc) : previousStaticClient(nc);
+        if (!firstClient)
             {
-            nc = previousStaticClient(nc);
-            } while (nc && nc != c &&
-                (( !options_traverse_all && !nc->isOnDesktop(currentDesktop())) ||
-                 nc->isMinimized() || !nc->wantsTabFocus() ) );
-        }
-    else
-        {
-            do
+            // When we see our first client for the second time,
+            // it's time to stop.
+            firstClient = nc;
+            }
+        else if (nc == firstClient)
             {
-            nc = nextStaticClient(nc);
-            } while (nc && nc != c &&
-                    (( !options_traverse_all && !nc->isOnDesktop(currentDesktop())) ||
-                     nc->isMinimized() || !nc->wantsTabFocus() ) );
-        }
-    if (c && c != nc)
-        lowerClient( c );
+            // No candidates found.
+            nc = 0;
+            break;
+            }
+        } while (nc && nc != c &&
+            (( !options_traverse_all && !nc->isOnDesktop(currentDesktop())) ||
+             nc->isMinimized() || !nc->wantsTabFocus() ) );
     if (nc)
         {
+        if (c && c != nc)
+            lowerClient( c );
         if ( options->focusPolicyIsReasonable() )
             {
             activateClient( nc );
Comment 7 Lubos Lunak 2006-01-04 22:34:44 UTC
*** Bug 118758 has been marked as a duplicate of this bug. ***