kwin 100% of cpu, second session

Bug #1272438 reported by DimanNe
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Arch Linux
New
Undecided
Unassigned
kde-workspace (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Steps to reproduce
Login as user1
Login as user2
Press Ctrl+Alt+F7 (to switch to first user)

kwin from second user starts to eat 100% of cpu.

Here is my investigation of what is going on

1) ====== GDB ======
I attached to running (and eating 100% of cpu) kwin, paused ("ctrl+c" command) and run ("continue" command) kwin several times and watched output of info threads command to figure out what thread is eating 100%.
What I got:

(gdb) info threads
  Id Target Id Frame
  3 Thread 0x7fa21ecb6700 (LWP 25128) "QProcessManager" 0x00007fa23f3c8de3 in select () at ../sysdeps/unix/syscall-template.S:81
  2 Thread 0x7fa21c9c6700 (LWP 25131) "kwin" pthread_cond_wait@@GLIBC_2.3.2 ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
* 1 Thread 0x7fa23fbfe7c0 (LWP 25123) "kwin" 0x00007fa236ea7f84 in __GI___pthread_mutex_lock (mutex=0x2520918) at pthread_mutex_lock.c:54
(gdb) continue

// continue, wait some time, ctrl+c

(gdb) info threads
  Id Target Id Frame
  3 Thread 0x7fa21ecb6700 (LWP 25128) "QProcessManager" 0x00007fa23f3c8de3 in select () at ../sysdeps/unix/syscall-template.S:81
  2 Thread 0x7fa21c9c6700 (LWP 25131) "kwin" pthread_cond_wait@@GLIBC_2.3.2 ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
* 1 Thread 0x7fa23fbfe7c0 (LWP 25123) "kwin" 0x00007fa23f3d1957 in __libc_recv (fd=9, buf=0x2520974, n=4096, flags=-1, flags@entry=0)
    at ../sysdeps/unix/sysv/linux/x86_64/recv.c:33

// continue, wait some time, ctrl+c

(gdb) info threads
  Id Target Id Frame
  3 Thread 0x7fa21ecb6700 (LWP 25128) "QProcessManager" 0x00007fa23f3c8de3 in select () at ../sysdeps/unix/syscall-template.S:81
  2 Thread 0x7fa21c9c6700 (LWP 25131) "kwin" pthread_cond_wait@@GLIBC_2.3.2 ()
    at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
* 1 Thread 0x7fa23fbfe7c0 (LWP 25123) "kwin" 0x00007fa23f3c8de3 in select () at ../sysdeps/unix/syscall-template.S:81

and so on...

As you can see first thread is really doing something.

Now, when I know thread number I can see backtrace:
First backtrace
[Switching to thread 1 (Thread 0x7fa23fbfe7c0 (LWP 25123))]
#0 0x00007fa238b11303 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
(gdb) backtrace
#0 0x00007fa238b11303 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#1 0x00007fa2396d05ef in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2 0x00007fa2396d08e5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3 0x00007fa2396d5e5b in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4 0x00007fa23f719956 in kdemain () from /usr/lib/kde4/libkdeinit/libkdeinit4_kwin.so
#5 0x00007fa23f2f7de5 in __libc_start_main (main=0x4006d0, argc=3, ubp_av=0x7ffffe010848, init=<optimized out>, fini=<optimized out>,
    rtld_fini=<optimized out>, stack_end=0x7ffffe010838) at libc-start.c:260
#6 0x00000000004006fe in _start ()

// continue, wait some time, ctrl+c

And second one (after "continue" and "ctrl+c")
(gdb) backtrace
#0 0x00007fa23f3c8de3 in select () at ../sysdeps/unix/syscall-template.S:81
#1 0x00007fa2396fc33b in qt_safe_select(int, fd_set*, fd_set*, fd_set*, timeval const*) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#2 0x00007fa239701904 in QEventDispatcherUNIXPrivate::doSelect(QFlags<QEventLoop::ProcessEventsFlag>, timeval*) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#3 0x00007fa239701d02 in QEventDispatcherUNIX::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) ()
   from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#4 0x00007fa238b112f6 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
#5 0x00007fa2396d05ef in QEventLoop::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#6 0x00007fa2396d08e5 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#7 0x00007fa2396d5e5b in QCoreApplication::exec() () from /usr/lib/x86_64-linux-gnu/libQtCore.so.4
#8 0x00007fa23f719956 in kdemain () from /usr/lib/kde4/libkdeinit/libkdeinit4_kwin.so
#9 0x00007fa23f2f7de5 in __libc_start_main (main=0x4006d0, argc=3, ubp_av=0x7ffffe010848, init=<optimized out>, fini=<optimized out>,
    rtld_fini=<optimized out>, stack_end=0x7ffffe010838) at libc-start.c:260
#10 0x00000000004006fe in _start ()
(gdb)

2) ====== strace ======
Now lets see which syscalls are called, I ran this command
strace -p 25123 -s 1000 -o strace1.txt
And in 1-2 seconds I got file (with 50000 lines) which contains ONLY these messages:

select(29, [4 5 9 10 14 28], [], [], {0, 0}) = 0 (Timeout)
recvfrom(9, 0x2520974, 4096, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
select(29, [4 5 9 10 14 28], [], [], {0, 0}) = 0 (Timeout)
recvfrom(9, 0x2520974, 4096, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
select(29, [4 5 9 10 14 28], [], [], {0, 0}) = 0 (Timeout)
recvfrom(9, 0x2520974, 4096, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
select(29, [4 5 9 10 14 28], [], [], {0, 0}) = 0 (Timeout)
recvfrom(9, 0x2520974, 4096, 0, 0, 0) = -1 EAGAIN (Resource temporarily unavailable)
select(29, [4 5 9 10 14 28], [], [], {0, 0}) = 0 (Timeout)

Notice first argument of recvfrom - 9, this fd we already saw at gdb "info threads":
* 1 Thread 0x7fa23fbfe7c0 (LWP 25123) "kwin" 0x00007fa23f3d1957 in __libc_recv (fd=9, buf=0x2520974, n=4096, flags=-1,

ProblemType: Bug
DistroRelease: Ubuntu 13.10
Package: kde-window-manager 4:4.11.3-0ubuntu0.1
ProcVersionSignature: Ubuntu 3.11.0-15.23-generic 3.11.10
Uname: Linux 3.11.0-15-generic x86_64
NonfreeKernelModules: nvidia
ApportVersion: 2.12.5-0ubuntu2.2
Architecture: amd64
Date: Fri Jan 24 21:20:31 2014
InstallationDate: Installed on 2013-11-11 (74 days ago)
InstallationMedia: Kubuntu 13.10 "Saucy Salamander" - Release amd64 (20131016.1)
MarkForUpload: True
SourcePackage: kde-workspace
UpgradeStatus: No upgrade log present (probably fresh install)

Arch forum posts:
https://bbs.archlinux.org/viewtopic.php?id=186904
https://bbs.archlinux.org/viewtopic.php?id=173030

Revision history for this message
DimanNe (dimanne) wrote :
description: updated
Revision history for this message
DimanNe (dimanne) wrote :

I am not sure, but it seems, that function denoted in gdb backtrace as
#0 0x00007fa238b11303 in ?? () from /usr/lib/x86_64-linux-gnu/libQtGui.so.4
is
bool QEventDispatcherX11::processEvents(QEventLoop::ProcessEventsFlags flags)
from
qt-src/src/gui/kernel/qeventdispatcher_x11.cpp

Revision history for this message
Rohan Garg (rohangarg) wrote :

Hi
Could you please install the Qt4 debug symbols (libqt4-dbg) and then submit a bug report on https://bugs.kde.org/enter_bug.cgi?format=guided against the 'kwin' product.

If you're running KDE SC < 4.12 . I would recommend upgrading to KDE SC 4.12.1 via the Kubuntu Backports PPA ( https://launchpad.net/~kubuntu-ppa/+archive/backports ) , reproducing the bug and reporting the bug on the KDE Bug tracker with appropriate backtraces.

Changed in kde-workspace (Ubuntu):
status: New → Invalid
Revision history for this message
John Hubbard (ender8282) wrote :

Was this ever reported upstream? If so would someone kindly piont me to the upstream bug. I am currently seeing this on kubuntu-14.04 using kde 4.13.

Revision history for this message
Paul Andreassen (paulone) wrote :

I've seen the lockup from kwin using 100% cpu on two different Kubuntu 14.04 machines, without needing to switch users. These machines were ungrades from previous versions, 12.04 and 13.10.

I think its fixed by resetting the kwin configure file by:

run "System Settings"
select "Configure desktop effects"
then clicking "Defaults" (at the bottom) and then "Apply" (at the bottom right).

If you can get to term with Alt-Ctrl-F1, you can use "DISPLAY=:0 kwin --replace" to fix a broken kwin using 100% cpu. This also works if you can "ssh" in.

Revision history for this message
Dima Ryazanov (dima-gmail) wrote :

I keep running into this every time I switch away from X. Here's a stack trace with Qt debug symbols, in KDE 4.13.3:

#0 0x00007f7514c4f8e3 in select () at ../sysdeps/unix/syscall-template.S:81
#1 0x00007f750f0401c7 in qt_safe_select (nfds=23, fdread=0xcf7f88, fdwrite=0xcf8220,
    fdexcept=0xcf84b8, orig_timeout=0x7fff4a848190) at kernel/qcore_unix.cpp:89
#2 0x00007f750f045824 in QEventDispatcherUNIXPrivate::doSelect (this=this@entry=0xcf7dd0,
    flags=..., timeout=0x7fff4a848190) at kernel/qeventdispatcher_unix.cpp:223
#3 0x00007f750f045c92 in QEventDispatcherUNIX::processEvents (this=this@entry=0xc98af0,
    flags=...) at kernel/qeventdispatcher_unix.cpp:936
#4 0x00007f750e4514d6 in QEventDispatcherX11::processEvents (this=0xc98af0, flags=...)
    at kernel/qeventdispatcher_x11.cpp:152
#5 0x00007f750f0140af in QEventLoop::processEvents (this=this@entry=0x7fff4a848460,
    flags=...) at kernel/qeventloop.cpp:149
#6 0x00007f750f0143a5 in QEventLoop::exec (this=this@entry=0x7fff4a848460, flags=...)
    at kernel/qeventloop.cpp:204
#7 0x00007f750f019b79 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1225
#8 0x00007f750e3ad37c in QApplication::exec () at kernel/qapplication.cpp:3828
#9 0x00007f7514f9e9d6 in kdemain (argc=3, argv=0x7fff4a848738) at ../../kwin/main.cpp:597
#10 0x00007f7514b7eec5 in __libc_start_main (main=0x4006d0 <main(int, char**)>, argc=3,
    argv=0x7fff4a848738, init=<optimized out>, fini=<optimized out>,
    rtld_fini=<optimized out>, stack_end=0x7fff4a848728) at libc-start.c:287
#11 0x00000000004006fe in _start ()

Changed in kde-workspace (Ubuntu):
status: Invalid → New
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in kde-workspace (Ubuntu):
status: New → Confirmed
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.