joe shaw

today hasn't exactly been going well

Is it really true that apps can’t gracefully recover from losing their connection to the X server? The XSetIOErrorHandler() man page says:

The XSetIOErrorHandler sets the fatal I/O error handler. Xlib calls the program’s supplied error handler if any sort of system call error occurs (for example, the connection to the server was lost). This is assumed to be a fatal condition, and the called routine should not return. If the I/O error handler does return, the client process exits.

This sucks! The Beagle daemon doesn’t require X, but if it’s available it listens to the screensaver extension to see whether or not the session is idle and speeds up indexing if it is. But if the X connection is at any point lost, the daemon exits immediately. This doesn’t give us a chance to gracefully shut down, and there doesn’t appear to be anything we can do about it, short of moving this screensaver code out of process. (Which would be a real pain, and slow down indexing in general.)

Anyone have any suggestions?