Bug 138196

Summary: After monitor standby, Xorg go to 100%
Product: [Plasma] kwin Reporter: Alex <alessandrosturniolo>
Component: generalAssignee: KWin default assignee <kwin-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: verslenet-kde
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: Two backtraces of kwin when kwin "hangs"
Another backtrace of kwin. First and second attach to the process.
Revert modification in layers.cpp

Description Alex 2006-12-01 08:06:58 UTC
Version:           KWin: 3.0 (Qt: 3.3.7 - KDE: 3.5.5 "release 45.1") (using KDE KDE 3.5.5)
Installed from:    SuSE RPMs
OS:                Linux

Situation:
I've KDE 3.5.5 (from SuSE 10.1 RPM repository) and Xorg 7.2-59.1 (from SuSE 10.1 RPM repository).
When the monitor go in standby (not the system), after resume, the Xorg process use the 100% of CPU time, and the system become unresponsive.
I've tried to turn off DPMS, screen saver, APIC (no ACPI), regenerate my xorg.conf with Sax2 tool (without vnc, 3d acceleration and other "strange" options), use nv module instead of nvidia.
Then I've noticed casually, that when kwin is not present all work fine.
Now, when I run metacity (for example) instead of kwin, the problem is not present.

I don't kwon if this is a problem of kwin or an xorg problem, but when the kwin process is run, after the resume, the system is unusable, and I've to force X server to shut down (CTRL+ALT+Backspace).

I've this problem, in two different PC, with the same software versions.

Here my xorg.conf file

# /.../
# SaX generated X11 config file
# Created on: 2006-11-25T18:14:31+0100.
#
# Version: 8.1
# Contact: Marcus Schaefer <sax@suse.de>, 2005
# Contact: SaX-User list <https://lists.berlios.de/mailman/listinfo/sax-users>
#
# Automatically generated by [ISaX] (8.1)
# PLEASE DO NOT EDIT THIS FILE!
#

Section "Files"
  FontPath     "/usr/share/fonts/misc:unscaled"
  FontPath     "/usr/X11R6/lib/X11/fonts/misc:unscaled"
  FontPath     "/usr/share/fonts/local"
  FontPath     "/usr/share/fonts/75dpi:unscaled"
  FontPath     "/usr/share/fonts/100dpi:unscaled"
  FontPath     "/usr/share/fonts/Type1"
  FontPath     "/usr/X11R6/lib/X11/fonts/Type1"
  FontPath     "/usr/share/fonts/URW"
  FontPath     "/usr/share/fonts/Speedo"
  FontPath     "/usr/share/fonts/PEX"
  FontPath     "/usr/share/fonts/cyrillic"
  FontPath     "/usr/share/fonts/latin2/misc:unscaled"
  FontPath     "/usr/share/fonts/latin2/75dpi:unscaled"
  FontPath     "/usr/share/fonts/latin2/100dpi:unscaled"
  FontPath     "/usr/share/fonts/latin2/Type1"
  FontPath     "/usr/share/fonts/latin7/75dpi:unscaled"
  FontPath     "/usr/share/fonts/baekmuk:unscaled"
  FontPath     "/usr/share/fonts/japanese:unscaled"
  FontPath     "/usr/share/fonts/kwintv"
  FontPath     "/usr/share/fonts/truetype"
  FontPath     "/usr/X11R6/lib/X11/fonts/truetype"
  FontPath     "/usr/share/fonts/uni:unscaled"
  FontPath     "/usr/share/fonts/CID"
  FontPath     "/usr/share/fonts/ucs/misc:unscaled"
  FontPath     "/usr/share/fonts/ucs/75dpi:unscaled"
  FontPath     "/usr/share/fonts/ucs/100dpi:unscaled"
  FontPath     "/usr/share/fonts/hellas/misc:unscaled"
  FontPath     "/usr/share/fonts/hellas/75dpi:unscaled"
  FontPath     "/usr/share/fonts/hellas/100dpi:unscaled"
  FontPath     "/usr/share/fonts/hellas/Type1"
  FontPath     "/usr/share/fonts/misc/sgi:unscaled"
  FontPath     "/usr/X11R6/lib/X11/fonts/misc/sgi:unscaled"
  FontPath     "/usr/share/fonts/xtest"
  FontPath     "/opt/kde3/share/fonts"
  FontPath     "unix/:7100"
  InputDevices "/dev/gpmdata"
  InputDevices "/dev/input/mice"
EndSection


Section "ServerFlags"
  Option       "AllowMouseOpenFail" "on"
  Option       "RandR" "on"
EndSection


Section "Module"
  Load         "type1"
  Load         "dbe"
  Load         "freetype"
  Load         "glx"
  Load         "v4l"
  Load         "extmod"
  Load         "vnc"
EndSection


Section "InputDevice"
  Identifier   "Keyboard[0]"
  Driver       "kbd"
  Option       "Protocol" "Standard"
  Option       "XkbLayout" "it"
  Option       "XkbModel" "logiik"
  Option       "XkbRules" "xfree86"
  Option       "AutoRepeat" "250 33"
EndSection


Section "InputDevice"
  Identifier   "Mouse[1]"
  Driver       "mouse"
  Option       "Buttons" "6"
  Option       "Device" "/dev/input/mice"
  Option       "Name" "PS2++ Logitech Wheel Mouse"
  Option       "Protocol" "explorerps/2"
  Option       "Vendor" "Logitech"
  Option       "ZAxisMapping" "4 5"
EndSection


Section "InputDevice"
  Driver       "rfbkeyb"
  Identifier   "Keyboard[2]"
  Option       "InputFashion" "VNC"
EndSection


Section "InputDevice"
  Driver       "rfbmouse"
  Identifier   "Mouse[3]"
  Option       "InputFashion" "VNC"
EndSection


Section "Monitor"
  Option       "CalcAlgorithm" "XServerPool"
  Identifier   "Monitor[0]"
  VendorName   "PHILIPS"
  ModelName    "BRILLIANCE 107P (107P2)"
  UseModes     "Modes[0]"
  DisplaySize  338    270
  HorizSync    30.0 - 92.0
  VertRefresh  50.0 - 160.0
  Option       "DPMS"
EndSection


Section "Modes"
  Identifier   "Modes[0]"
EndSection


Section "Screen"
  DefaultDepth 24
  SubSection "Display"
    Depth      24
    Modes      "1280x1024" "1024x768" "800x600"
  EndSubSection
  Device       "Device[0]"
  Identifier   "Screen[0]"
  Monitor      "Monitor[0]"
EndSection


Section "Device"
  BoardName    "GeForce FX 5500"
  BusID        "2:0:0"
  Driver       "nvidia"
  Identifier   "Device[0]"
  Option       "NoLogo"
  Option       "NvAGP" "1"
  Option       "AGPMode" "8"
  Option       "xv" "true"
  Option       "mtrr" "on"
  Option       "DRI" "true"
  Option       "Accel" "true"
  Option       "RenderAccel" "true"
  Option       "AccelMethod" "exa"
  Option       "EnablePageFlip" "True"
  Option       "BackingStore" "true"
  Option       "TripleBuffer" "true"
  Option       "AddARGBGLXVisuals"     "true"
  Option       "EnablePrivateBackZ" "no"
  Option       "AllowGLXWithComposite" "true"
  Option       "XAANoOffscreenPixmaps" "true"
  Option       "DisableGLXRootClipping" "True"
  Option       "XvmcUsesTextures" "true"
  Option       "Overlay" "true"
  Option       "Rotate" "off"
  Option       "DigitalVibrance" "4"
  Option       "ImageSharpening" "3"
  Option       "UseEDID" "false"
  Option       "rfbauth" "/root/.vnc/passwd"
  Option       "rfbport" "5900"
  Option       "usevnc" "yes"
  Option       "localhost" "on"
  VendorName   "NVidia"
  Screen       0
EndSection


Section "ServerLayout"
  Identifier   "Layout[all]"
  InputDevice  "Keyboard[0]" "CoreKeyboard"
  InputDevice  "Mouse[1]" "CorePointer"
  InputDevice  "Keyboard[2]" "ExtraKeyboard"
  InputDevice  "Mouse[3]" "ExtraPointer"
  Option       "Clone" "off"
  Option       "Xinerama" "off"
  Option       "VNC" "3 2"
  Screen       "Screen[0]"
EndSection


Section "DRI"
    Group      "video"
    Mode       0666
EndSection


Section "Extensions"
    Option         "Composite" "Enable"
    Option         "RENDER" "Enable"
    Option         "DAMAGE" "Enable"
EndSection
Comment 1 Lubos Lunak 2006-12-11 17:36:53 UTC
I've never seen that, so you'll need to provide more information: After this occurs, change to text console, log in there, find the pid of kwin ("pidof kwin"), run "gdb -p <pid>" and type "bt" to get the backtrace (and "quit" to leave afterwards). Then attach the backtrace here, possibly several of them if they differ on different runs (you gpm to copy&paste them or run gdb as "gdb -p <pid> | tee /tmp/gdb.txt" to also write the output to a file).
Comment 2 Lubos Lunak 2007-01-26 17:44:53 UTC
Waiting for a response.
Comment 3 Rudolf Kollien 2007-03-29 14:44:51 UTC
I can confirm this. Using two different PC 
- SuSE 9.3, Matrox G450 Dual-Head, KDE 3.5.6
- SuSE 10.1, Nvidia GForce, Dual-Head, KDE 3.5.6

The problem came up with KDE 3.5.5. The "X"-process consumes nearly 100% CPU. I've to switch to the text console and do a killall -9 X as there is no response to "Ctrl-Alt-Backspace".

In my case, the screen has to be in suspend mode for a longer time (> 30 minutes). And not always the problem occurs. I didn't assign this to kwin, because the X-server itself eats my cpu.

The next time i get this error i will try to do a gdb and attach the trace.
Comment 4 Rudolf Kollien 2007-04-09 16:24:26 UTC
Created attachment 20216 [details]
Two backtraces of kwin when kwin "hangs"

Archive contains two (back)traces from a KDE session hanging. When this
happened, the "window decorations" where gone and there is no response of any
window. Mouse moving is still possible. Keyboard input too, but not visible
response (f.e. in Konsole's terminal window.

Looking with "top" or "ps" for the proccess status, the "X"-server consumes
about 95%-98% of CPU.

Hope this helps.
Rudolf
Comment 5 Lubos Lunak 2007-04-10 11:53:25 UTC
The backtraces don't seem to show anything interesting. When this happens, is the backtrace always the same, even after you leave gdb and re-attach?
Comment 6 Rudolf Kollien 2007-04-10 12:08:41 UTC
I didn't try to reconnect and re-attach. I only did as instructed in comment #1. But as soon as this happens again, i will do as you say and do a second backtrace. 
Comment 7 Rudolf Kollien 2007-04-12 11:50:54 UTC
Created attachment 20246 [details]
Another backtrace of kwin. First and second attach to the process.

These are two backtraces of one hanging kwin process. After taking the first
bt, i detached and reattached to the same process. I don't think, they differ.

Additional, i took a bt from the (looping) X process. But don't know, if this
is of interest or helps in any way.
Comment 8 Damian Wawrzyniak 2007-04-15 17:06:45 UTC
The same happens here.
Suse 10.1, Radeon 9550, KDE 3.5.6
But in my case it also happens with the power management turned off.
Just leaving the computer for a longer period is enough to cause this behaviour.
And it doesn't seem to be related only to Suse.
Have a look at this: http://www.redhat.com/archives/fedora-list/2007-March/msg02531.html
Comment 9 Simon Yuan 2007-04-22 13:56:55 UTC
I have exactly this problem too on Arch Linux. I'm running KDE 3.5.6 using nVidia's proprietary driver.

I'm also suspecting it happens mostly when the monitor resumes from standby but like others said not always reproducible.

I have another computer of similar hardware setup, but DPMS and monitor power saving are disabled. It never had this problem.

Although I really don't know if it's Xorg's, KDE's or nVidia's problem, but seeing comment #8 above, I guess it's not driver related.
Comment 10 Rudolf Kollien 2007-04-23 07:53:24 UTC
Don't think it's nether related to the video driver as we see nVidia, Matrox and ATI in this bug report, nor seems it to be related to the X system, as we have different versions of it, too. 

As on comment #9, we should also exclude SuSE as the origin of the problem. 

Looks like the problem came up with KDE 3.5.5
Comment 11 brian labbie 2007-05-17 01:50:11 UTC
*** This bug has been confirmed by popular vote. ***
Comment 12 Eddy Flas 2007-07-29 03:04:18 UTC
I experience something very similar here.
At first I thought nvidia was responsible but I still get the problem without using the nvidia driver. But I never get it (on the same machine of course) when I use wmaker : it only happens while I use kde.

I use kubuntu 7.04 - kde 3.5.6 - nvidia FX 5200
Comment 13 Damian Wawrzyniak 2007-07-29 10:14:21 UTC
Are you running Superkaramba by any chance? I used to have the same problem ,as you can see in comment #8, but managed to solve it by turning off some of the applets (I had about 8 at the time). I has been OK ever since.
Comment 14 Eddy Flas 2007-07-31 11:06:51 UTC
Thank you.
Indeed I have stopped superkaramba 2 days ago and used my computer with no problem at all. I still get very high cpu usage by xorg from time to time but nothing abnormal I think. When I wrote comment #12, I would get a freeze in between a few minutes to 2 hours.
Comment 15 Lubos Lunak 2007-08-02 15:11:20 UTC
Please provide more details on how to reproduce the problem. How is one supposed to configure a newly created KDE account?
Comment 16 Tadeusz Kascha 2007-08-21 12:37:19 UTC
I confirm this problem.
Linux ghost 2.6.22-gentoo-r2-custom #8 SMP PREEMPT Sat Aug 18 18:02:19 CEST 2007 i686 AMD Athlon(tm) XP 3000+ AuthenticAMD GNU/Linux

lspci-> http://wklej.org/id/5d4571edc0

kdebase: 3.5.7-r3
Comment 17 Simon Yuan 2007-08-22 08:35:32 UTC
I haven't been able to reproduce this problem since the upgrade to 3.5.7, however monitor doesn't always go standby when idle. It sometimes does and others times doesn't.
Comment 18 Tadeusz Kascha 2007-08-24 17:51:35 UTC
3 days without superkaramba... 0 Xorg deadlocks... :]
Comment 19 brian labbie 2007-08-24 18:07:10 UTC
turned off several superkaramba applets and no lock ups for 8 days now
Comment 20 Lubos Lunak 2007-09-24 11:23:13 UTC
See comment #15. I'm sorry, but there's not much to do about this problem without having some useful information. If you can provide it, please reopen.
Comment 21 Alex 2007-12-05 21:31:44 UTC
I've done some other test. This is what I've founded:

The problem is introduced by kwin 3.5.6. On my Gentoo I've forced the system to install kwin 3.5.5 (with kde 3.5.7), and the problem is disappeared. With kwin 3.5.6 the problem come back.

I've tried to downgrade only superkaramba, to previous versions, but with no success.

The problem is most frequent with applet with fast update time (1 second or less).

The problem is observable also without a screen saver. After few minutes (3-4) the CPU usage begins to grow, and after 10 minutes the PC is unusable, because Xorg (a process that running with root privileges) use 100% of CPU. My system is a single CPU Athlon XP 3000 (a 32bit single core CPU). It's possible that with multi CPU, or a recent PC, the system stay usable.

I don't know if is a bug of Xorg, superkaramba or kwin, but I know that without kwin, or with kwin <= 3.5.5, the problem disappear.

To reproduce this bug, use kwin >= 3.5.6, superkaramba and a lot of applet (clocks, system monitors, and some other with frequent updates), then leave your system, and come back after 30 minutes.

Thank you.
Comment 22 Alex 2007-12-23 20:24:12 UTC
Recently I've installed openSuSE 10.3 on my new laptop, an AMD Athlon 64 X2, and with superkaramba enabled, this recent system, present the same problem, that I've observed on my AMD single core PC.

On SuSE, I've found that the problem of the 100% CPU usage by Xorg, is present also on 3.5.5 version of kwin.

Then I've reverted some of the SuSE patches, and I've found that the 3_5_BRANCH_kde_128648.diff introduce this "bug".

I've reverted some pieces of this patch, and I've found that the code modified in layers.cpp is probably the cause of this bug.

This is a patch to revert this code for kwin 3.5.7:

--- kwin/layers.cpp     2007-12-23 18:39:28.000000000 +0100
+++ kine/layers.cpp.sav 2007-12-23 18:39:55.000000000 +0100
@@ -117,11 +117,11 @@ void Workspace::updateStackingOrder( boo
         }
 #endif
     if( changed || propagate_new_clients )
-        {
+//        {
         propagateClients( propagate_new_clients );
-        if( active_client )
-            active_client->updateMouseGrab();
-        }
+//        if( active_client )
+//            active_client->updateMouseGrab();
+//        }
     }

 /*!

Comment 23 Alex 2007-12-23 20:27:00 UTC
Created attachment 22663 [details]
Revert modification in layers.cpp

Without the code, removed by this patch, on my systems (Gentoo and openSuSE
10.3), the problem of 100% CPU usage by Xorg is disappeared.
Comment 24 Alex 2008-03-19 10:24:03 UTC
Bump?

Now, at every update of kdebase3 package, I have to recompile the sources with the patch applied on all my systems.

At this time, I've tested this patch on Gentoo (with kde 3.5.8), openSuSE 10.3 x86, and openSuSE 10.3 x86_64 (both with kde 3.5.9).
Comment 25 Lubos Lunak 2008-03-20 18:39:55 UTC

*** This bug has been marked as a duplicate of 143255 ***