[ConsoleKit] Race issue with ConsoleKit restart/shutdown
halfline at gmail.com
Mon Aug 30 18:57:13 PDT 2010
On Mon, Aug 30, 2010 at 6:08 PM, Brian Cameron <brian.cameron at oracle.com> wrote:
> I spent some time reviewing the code with Ray Strode, and it looks like
> gnome-session tells ConsoleKit to do a shutdown or restart. Then
> gnome-session waits for the ConsoleKit "privileges-completed" signal
> and logs out the user session.
So just to give a few more details about the problem.
When the user chooses Shutdown from the shutdown dialog in the
session, gnome-session will call the ConsoleKit "Stop" method. This
is a blocking call that blocks until the ck-system-stop script
This script just calls shutdown -h now or whatever to signal init to shutdown.
shutdown -h now is asynchronous, though. It returns immediately, and
shutdown progresses in the background.
So, once shut down is "fired off" and on-going in the background, the
Stop() method returns and gnome-session procedes to log out.
So, there's a race where gnome-session will logout before the init
system sends a SIGTERM to gdm. If that race wins, then when GDM
detects the logout and starts to put up a new login screen which is
We need some way to inform GDM that shutdown is happening, so that
Many moons ago, before we used ConsoleKit for initiating shutdown,
gnome-session told GDM directly to shutdown, so it knew and could
avoid putting back up a login screen.
We probably need to add some hook to or emit some signal of some kind
from ConsoleKit so that GDM can get notified about shutdown.
More information about the ConsoleKit