Bug 5877

Summary: [PATCH]X server takes 100% CPU, in endless select()/read() loop
Product: xorg Reporter: Max Kellermann <max>
Component: Protocol/CoreAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: high CC: erik.andren, shrek
Version: 6.9.0Keywords: patch
Hardware: x86 (IA32)   
OS: Linux (All)   
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 5041    
Description Flags
xorg-x11- none

Description Max Kellermann 2006-02-14 00:15:42 UTC
Debian X.org packages 6.9.0.dfsg.1-3 on AMD64 (Athlon64 X2), Linux,
NVidia non-free driver 1.0-8174.

After several days, the X server shows as using 100% CPU in top. It still works
well, and due to my CPU being dual core, this is not noticeable. An strace
revealed that he was reading from a socket over and over:

select(256, [1 3 4 9 15 16 17 18 19 20 22 23 24 25 26 27 28 29 30 31 32 33 34 35
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 56 57 59 62], NULL, NULL, {0,
498000}) = 1 (in [3], left {0, 500000})
read(3, "", 80)                         = 0

There are other bug reports on X.org using 100% CPU, but my strace indicated
this bug is different. I also believe (and hope) this hasn't got anything to do
with the closed source nvidia driver, as this seems to happen in the main loop.
Comment 1 Adam Jackson 2006-02-14 18:48:48 UTC
the nvidia driver is totally capable of feeding file descriptors to the main loop.

it would be helpful if you could figure out what program is on the other end of
fd 3 when this happens.
Comment 2 Max Kellermann 2006-02-14 19:09:00 UTC
I just found a way to reproduce that easily - the X server was connected to the
ACPI daemon on file descriptor 3 (/var/run/acpid.socket). When I stopped acpid,
the X server entered the state of 100% CPU consumption. Restarting acpid does
not fix that once it happened. Could have happened after acpid upgrades..
Comment 3 Valery Inozemtsev 2006-03-06 00:36:42 UTC
Created attachment 4829 [details] [review]

this patch fixed problem with ACPI
Comment 4 Erik Andren 2006-04-17 21:22:57 UTC
Marking topic as patch.
Comment 5 Erik Andren 2006-04-18 05:12:39 UTC
Added patch keyword
Comment 6 Adam Jackson 2006-05-16 04:29:21 UTC
(In reply to comment #3)
> Created an attachment (id=4829) [edit]
> xorg-x11-
> this patch fixed problem with ACPI

Is there a reason you dropped support for reading /proc/acpi/event directly?  I
think i'm fine with the idea of requiring acpid to be running but I'd like to
know if there's a tradeoff involved.
Comment 7 Valery Inozemtsev 2006-05-16 05:09:44 UTC
system with /proc/acpi/event usually have working acpid. however, if X server 
would start before acpid, then acpid couldn't start.
Comment 8 Adam Jackson 2006-05-19 04:18:48 UTC
applied with minor fixups, thanks!

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.