xserver at 100% CPU on dbus-daemon restart
Submitted by ale..@..t.aero
Assigned to Xorg Project Team
Link to original bug (#103465)
Description
The Xorg server 1.17.4 (from OL 6.9: xorg-x11-server-Xorg-1.17.4-16.0.1.el6.x86_64) goes to 100% CPU usage if the system dbus-daemon is restarted.
The command "service messagebus restart" restarts the system dbus-daemon. Then the X server in os/WaitFor.c:WaitForSomething() calls config/dbus-core.c:wakeup_handler:
static void wakeup_handler(void *data, int err, void *read_mask)
on the second invocation err is -1 and therefore dbus_connection_read_write_dispatch is not called. I think the dbus dispatch would close the socket.
Now WaitForSomething is in a endloss loop where it tries to poll and calls wakeup_handler, but the socket is never closed.
This worked properly on Xorg server 1.15.0, i.e. the socket was closed and later reopened by dbus reconnect_timer.
I think the regression was introduced with:
commit bcb17b99 Author: Ray Strode rstrode@redhat.com Date: Thu Apr 24 13:38:28 2014 -0400
dbus: don't dispatch dbus events on select() EINTR
wakeup handlers are called even when select() returns EINTR,
and when they're called the passed fd set is undefined.
This commit fixes the dbus wakeup handler to avoid dispatching
into dbus spuriously.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Ray Strode <rstrode@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
When I revert this commit a dbus-daemon restart works as expected without the Xorg server going to 100% CPU usage. The socket is properly reconnected.