Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm hitting a problem whereby X prevents processes from creating windows, uttering something like the following into ~/.xsession-errors:

cannot open display: :0.0
Maximum number of clients reached

Searching around there are lots of examples of people facing this problem, and sometimes people identify which program they are running is using up all the client slots. See e.g. LP 70872 (Firefox), LP 263211 (gnome-screensaver).

For what it's worth, I run gnome-terminal, thunderbird, chromium-browser, empathy, tomboy and virtualbox nearly all the time, on top of the normal stuff you get with the GNOME desktop, and occasionally some other bits and pieces.

However my question is not "which of my programs is causing this problem" but rather, how can one go about diagnosing this problem?

In the above (and other) bugs, forum reports, etc., a number of tools are suggested:

  • xlsclients - lists the client applications for the given display, but I don't think that corresponds to 'X clients'
  • xrestop - a top-style X resources tool, one row per X client. Lots of '' clients, not shown in xlsclients output
  • xwininfo -root -children lists X window objects

From what I can gather, the problem might not be too many clients at all, but rather resources kept around in the X server for clients who have long-since detached. But it would also appear that you cannot (easily?) relate X resources back to their client. Can one effectively diagnose this issue once it has started to occur, or is a tedious divide-and-conquer approach for the apps I run the only approach open to me?

Update Jan 2011: I think I have resolved this issue. For the benefit of anyone stumbling across this, nautilus and/or compiz or something in that chain of software was segfaulting due to a wallpaper I had. I had chosen an XML file as my wallpaper, which defined a rotating gallery of images. It was hand-made, but based on /usr/share/backgrounds/contest/background-1.xml or similar. Disabling the wallpaper and I have not had a crash since.

I'm not marking this as answered yet, since the actual specific problem was not my question, but how to diagnose it was. Unfortunately this was mostly trial-and-error which sucks.

share|improve this question
Have you checked the xrestop output? What do the first 3 lines tell you? How much memory/video memory do you have in the machine? – jneves Oct 10 '10 at 9:25

2 Answers

Chromium/Chrome has some known issues which result in this error message. Do you use the Lastpass extension?

ref: http://www.ngohaibac.com/how-to-solve-maximum-number-of-clients-reached-gtk-warning-cannot-open-display-in-ubuntu-9-10-64-bit/

share|improve this answer
I do not use that extension. – jmtd Oct 13 '10 at 22:51
Still worth testing the system with Chromium removed to see if it alleviates the problem. Not sure how you'd fix it once confirmed (short of removing Chromium, which I assume you'd want to avoid if possible). – Jeremy Oct 14 '10 at 0:55
As a last-ditch effort I could try that. The same applies to other software that google points the finger at, e.g., gnome-screensaver. The trouble is, I use chromium pretty heavily, so removing it, even temporarily, is quite a blow to my working practices. What I would really like to do is prove it was responsible without having to stop using it. – jmtd Nov 4 '10 at 13:51

I have the same question, because I think this issue is significant for anyone who does not reboot their computer often. One thing I've really liked about UNIX/Linux/Ubuntu over the years is that I can reliably run my laptop for months without rebooting (suspending only), except when I install a new kernel. Since upgrading to the "suite" that is Maverick (Ubuntu 10.10), I've encountered this and can only run for a week.

I've tried 'xrestop', too; stopped the compiz window effects (that slowed down the resource leak), but still cannot find out why this is happening. It's almost like being back on a WinXP machine... :-(

So yes! Better X debugging tools would be good. One problem with 'xrestop' is that it requires resources, too, so once you hit the wall, even it won't run.

As a tip to others who get stuck by this (eg: when resuming from Standby and waiting for the password window that will never appear because there are no resources to create it), switching to a frame buffer terminal and back (Ctrl-Alt-F1, then Ctrl-Alt-F7) seems to free a few of the critical resources.

Doug

share|improve this answer
Just did some more searching and found a useful Python script to debug my problem (thanks Adam!). This allowed me to notice that an addon to my mail program, Thunderbird's Minimize-to-tray, was consuming extra file descriptors, 4 per minimize. Disabling it appears to have resolved the problem. – user10906 Feb 15 '11 at 21:42
@user10906 That script is unusable: IndexError: list index out of range because some lines hasn't Path in netstat -an --unix output. – Simón Jan 7 at 11:52

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.