Allan
Allan

Reputation: 4720

Xorg stops working after all X applications has exited

I have a simple application which I use to determinate when my X server is ready. The application is used in the init process, and all X-applications depend on it to be completed. It keeps on trying to connect, and when it does get a connection, it simply exits.

int main(int argc, const char *argv[])
{
    Display *dis;

    while(1){
        dis = XOpenDisplay(NULL);

        if(dis != 0)
            break;
        usleep(1000);
    }

    if(dis != 0)
       XCloseDisplay(dis);

    return 0;
}

My problem is, that after I upgraded my Nvidia driver, none of the X-applications was able to display anything on the screen, if they ran after this simple test.

Also, if I run xeyes as the first application, then it works. Then if I press Ctrl-c ( to end the running xeyes application), and start a new one, nothing is displayed on the screen, but no errors appear on the screen.

Is this the expected behavioral? Is Xorg supposed to stop working after the last X-application has exited?

Upvotes: 1

Views: 571

Answers (2)

pzanoni
pzanoni

Reputation: 3039

X has the concept of "server generations": whenever the last clients disconnects from the X server, the server tries to reset itself and then we say it started a new "generation". Most users never get past the first generation, so multiple generations are not tested very much, so it is not a big surprise if you trigger a bug when using multiple generations. There are often memory leaks when new generations are triggered. If you find a bug triggered when the X server gets to new server generations, please report it to bugs.freedesktop.org.

From your environment description, it seems you're triggering new server generations. You can start X with "-noreset" to avoid having the server reset, possibly hiding any existing bugs (it is a good test!).

As a side note, you might consider replacing the program you pasted for a scheme using SIGUSR1. The following text is from "man Xserver":

  SIGUSR1 This  signal  is  used  quite  differently from either of the above.
          When the server starts, it checks to see if it has inherited
          SIGUSR1 as SIG_IGN instead of the usual SIG_DFL.  In this case, the server
          sends a SIGUSR1 to its parent process after it has  set
          up the various connection schemes.  Xdm uses this feature to recognize
          when connecting to the server is possible.

Upvotes: 2

sehe
sehe

Reputation: 393567

This is obviously not expected behaviour.

But the fact that you are using this 'polling' program indicates to me that you are trying to workaround other bugs.

There have been known issues with fast-booting machines, Ubuntu+Nvidia+plymouth; See if you can upgrade your system or disable plymouth?

Also, can you check what vty X is running on when it 'stops working' ?

ps -ef | grep X
gdmtty="$(ps --no-heading -o tty -p $(pgrep X))"
stty -F "/dev/$gdmtty"
ps -f -t "$gdmtty"

(sometimes the terminal flags with regard to SIGNALS would be inapropriate for XServer and your Ctrl-C might cause the issue then).

Upvotes: 0

Related Questions