Recovering Disconnected X Applications

Glynn Clements glynn at gclements.plus.com
Fri Jun 10 21:01:16 PDT 2005


Adrien Guillon wrote:

>     Sometimes I am in a position where it would be nice to recover 
> applications which have been disconnected from the display. Let me explain:
> 
>     Imagine users connected through XDMCP to a GDM session. Their local 
> X terminal crashes. Somehow, some applications may still running on the 
> server. For instance, an openoffice application.  When the user is 
> disconnected, I can still see (sometimes) their running applications. It 
> would be very nice if I could do something like 'fg PID' to bring it 
> forward to the new X session, and recover whatever they were working on. 
> The DISPLAY number hasn't change, and it almost seems if I could sent a 
> refresh signal I would recover the application (once the X terminal is 
> back to life).
> 
>     Is it possible to recover such applications,

No.

> or are they really 
> dead, but still lingering? Is there any way to write such a utility, or 
> does the X protocol by its nature forbid this type of recovery?

It doesn't forbid it, but it would take a fair amount of effort to
realise such a scheme.

For a start, the connection between the client and the X server is
closed by the OS kernel when the X server terminates, and the
connection can't be "restored" at the OS level.

The toolkit (or Xlib) could be modified to allow a new X connection to
be opened and to replace the closed connection. However, none of the
server-side resources (windows, pixmaps, fonts, colourmaps etc) which
existed in the old X server will exist on the new X server.

So, the toolkit would need to be capable of re-creating all
of the server-side resources purely from client-side data. This would
be far from trivial to implement.

One potential solution is to use run the session on a "virtual" X
server such as Xvnc, then just run the vncviewer client on the real X
server (X terminal). If the X terminal crashes, you can just re-start
vncviewer and re-connect to the Xvnc session. However:

1. That won't help if Xvnc itself crashes (although, as it doesn't do
any hardware access, Xvnc tends to be more reliable than a normal X
server).

2. Xvnc can't provide hardware acceleration, which can make it
unusable for uses such as real-time 3D or video playback.

-- 
Glynn Clements <glynn at gclements.plus.com>



More information about the xorg mailing list