[PATCH rhel7-branch] Fix hang at reboot with VNC installs (#1036572)

Will Woods wwoods at redhat.com
Tue Sep 9 14:27:45 UTC 2014

On Tue, 2014-09-09 at 10:48 +0200, Vratislav Podzimek wrote:
> On Mon, 2014-09-08 at 19:22 -0400, Will Woods wrote:
> > Calling vnc.shutdownServer() causes the window manager to terminate
> > (naturally), which makes startMetacityWM() call os._exit(0).
> > 
> I'm sorry, but I don't see the os._exit(0) call the window manager
> termination leads to. Is there any thread watching the window manager
> process and calling it when it terminates?

Hmm. I think you're right - my explanation is incorrect, but the patch
*does* fix the problem.

The os._exit I was referring to is in startMetacityWM(), but now that I
look closer, it only happens in the child process:

def startMetacityWM():
    childpid = os.fork()
    if not childpid:
        # after this point the method should never return (or throw an
        # outside)
            iutil.execWithRedirect('metacity', ["--display", ":1",
        except BaseException as e:
            # catch all possible exceptions
            log.error("Problems running the window manager: %s", str(e))

        log.info("The window manager has terminated.")
    return childpid

On the other hand, patching anaconda as shown *does* make reboot work on
VNC installs. So what's the correct mechanism? I asked in RH #desktop:

09:53 < wwoods> what happens to (gtk) processes when the X server dies?
09:53 < halfline> one of two things, that both lead to the process dying
09:53 < halfline> 1) dbus-daemon notices its X connection goes away, and
the programs notice dbus goes away so they exit
09:54 < halfline> 2) the programs themselves notice X goes away, and
they exit
09:57 < halfline> well what's happening is the default x io error
handler calls exit(1)
10:04 < halfline> when a dbus-client gets kicked off the message bus it
either calls exit(1), raises SIGTERM, or does its own explicit handling
10:04 < halfline> exit(1) is performed by libdbus clients,
raise(SIGTERM) is performed by gdbus clients

So, yeah. This explains why killing the X server / Xvnc causes anaconda
to exit before it calls 'systemctl reboot'.

I'll fix the commit message and comment and resend the patch.


More information about the anaconda-patches mailing list