Xlib: Maximum number of clients reached

Every two weeks i get this:

$ xterm &
Xlib: connection to ":0.0" refused by server
Xlib: Maximum number of clients reached
xterm Xt error: Can't open display: :0.0

and it looks that something eats up the possible number of Clients:

$ xlsclients |wc -l
56

when i restart X i can open about 100 xterms until i reach the error message.

ideas?

distribution: 

Comments

Gecko-based webbrowsers (+ some plugins) tend to eat clients.

I don't run browsers on that machine, but i suspect gkrellm or synergy to eat up the clients, but how can i find out?

DOes "xlsclients" not tell you what you need to know?

Nope. It tells me which clients are there. it doesn'T tell me why i can run about 100 Clients after X restart and only 50 or less two weeks later.

Hmm, I was going to suggest `lsof` but it seems to only show the X server side of the socket, even with -U; the client side is "unix 0x0000000000000000" but that's the same for dbus and other unix domain sockets too, which is strange. (It would at least let you see how many things really do have connections open; `/tmp/.X11-unix/X0` is `:0` in particular...

Some of your user-space stuff is calling XOpenDisplay without XCloseDisplay. There's probably some app to show that, but xlsclients won't help you.

Try this program:

/* gcc clients.c -o clients -lX11 */
#include
#include
int main(void) {
int i;
for (i = 0; i < 512; i++) {
if (!XOpenDisplay(NULL)) {
printf("Went up to %d\n", i);
break;
}
}
return 0;
}