"Maximum number of clients reached"

Bug #1518411 reported by Jonathan Kamens
This bug affects 11 people
Affects Status Importance Assigned to Milestone
compiz (Ubuntu)
Nominated for Wily by Alberto Salvia Novella
xorg-server (Ubuntu)
Nominated for Wily by Alberto Salvia Novella

Bug Description

In my newly upgraded (from 15.04) Ubuntu 15.10 system, after I've been logged in for a while I can no longer open new windows and instead get a "Maximum number of clients reached" error.

This did not happen in 15.04.

I ran "lsof" on the X server and did not see an excessive number of open file descriptors. I ran it again on a newly restarted X server and the number of open file descriptors looked about the same.

I also ran "xlsclients" when the X server was reporting "Maximum number of clients reached" and the list of clients looked correct and reasonable (and there were less than 30 of them).

I am happy to collect any additional logs or debugging information to help track this down. I don't know where to look further.

ProblemType: Bug
DistroRelease: Ubuntu 15.10
Package: xserver-xorg 1:7.7+7ubuntu4
ProcVersionSignature: Ubuntu 4.2.0-18.22-generic 4.2.3
Uname: Linux 4.2.0-18-generic x86_64

ApportVersion: 2.19.1-0ubuntu5
Architecture: amd64
CompizPlugins: No value set for `/apps/compiz-1/general/screen0/options/active_plugins'
CompositorRunning: compiz
CompositorUnredirectDriverBlacklist: '(nouveau|Intel).*Mesa 8.0'
CompositorUnredirectFSW: true
CurrentDesktop: Unity
Date: Fri Nov 20 13:00:09 2015
DistUpgraded: 2015-11-17 11:59:09,835 DEBUG enabling apt cron job
DistroCodename: wily
DistroVariant: ubuntu
 virtualbox, 5.0.4, 3.19.0-33-generic, x86_64: installed
 virtualbox, 5.0.4, 4.2.0-18-generic, x86_64: installed
ExtraDebuggingInterest: Yes
 Intel Corporation Crystal Well Integrated Graphics Controller [8086:0d26] (rev 08) (prog-if 00 [VGA controller])
   Subsystem: CLEVO/KAPOK Computer Device [1558:7410]
MachineType: System76, Inc. Galago UltraPro
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-4.2.0-18-generic root=UUID=821f94aa-97e2-4384-8494-9f510a75877b ro i915.disable_power_well=0 quiet splash vt.handoff=7
SourcePackage: xorg
UpgradeStatus: Upgraded to wily on 2015-11-17 (3 days ago)
dmi.bios.date: 12/12/2013
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 4.6.5
dmi.board.asset.tag: Tag 12345
dmi.board.name: W740SU
dmi.board.vendor: Notebook
dmi.board.version: Not Applicable
dmi.chassis.asset.tag: No Asset Tag
dmi.chassis.type: 9
dmi.chassis.vendor: Notebook
dmi.chassis.version: N/A
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr4.6.5:bd12/12/2013:svnSystem76,Inc.:pnGalagoUltraPro:pvrgalu1:rvnNotebook:rnW740SU:rvrNotApplicable:cvnNotebook:ct9:cvrN/A:
dmi.product.name: Galago UltraPro
dmi.product.version: galu1
dmi.sys.vendor: System76, Inc.
version.compiz: compiz 1:
version.ia32-libs: ia32-libs N/A
version.libdrm2: libdrm2 2.4.64-1
version.libgl1-mesa-dri: libgl1-mesa-dri 11.0.2-1ubuntu4
version.libgl1-mesa-dri-experimental: libgl1-mesa-dri-experimental N/A
version.libgl1-mesa-glx: libgl1-mesa-glx 11.0.2-1ubuntu4
version.xserver-xorg-core: xserver-xorg-core 2:1.17.2-1ubuntu9
version.xserver-xorg-input-evdev: xserver-xorg-input-evdev 1:2.9.2-1ubuntu1
version.xserver-xorg-video-ati: xserver-xorg-video-ati 1:7.5.0+git20150819-0ubuntu1
version.xserver-xorg-video-intel: xserver-xorg-video-intel 2:2.99.917+git20150808-0ubuntu4
version.xserver-xorg-video-nouveau: xserver-xorg-video-nouveau 1:1.0.11-1ubuntu3
xserver.bootTime: Fri Nov 20 12:51:23 2015
xserver.configfile: default

xserver.logfile: /var/log/Xorg.0.log
xserver.version: 2:1.17.2-1ubuntu9
xserver.video_driver: intel

Revision history for this message
Jonathan Kamens (jik) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in xorg (Ubuntu):
status: New → Confirmed
Revision history for this message
MP Momo (mplove) wrote :

Makes two.. I've got the same problem

Revision history for this message
Jonathan Kamens (jik) wrote :

This has something to do with the fact that I have a script running in the background that changes my background image every couple minutes. When I disable that script, the problem goes away.

Revision history for this message
Alberto Salvia Novella (es20490446e) wrote :

If that script is provided in an official Ubuntu package, please:

1. Change the package from xorg to that one.
2. Set its status to "confirmed".

Thank you.

Changed in xorg (Ubuntu):
status: Confirmed → Invalid
Revision history for this message
Jonathan Kamens (jik) wrote :

It's a script I wrote myself. I would be happy to share it if that would be useful.

I do not understand why you marked this issue invalid.

Surely you are not meaning to suggest that it is invalid for users to write their own tools which periodically change the desktop background using the interfaces that are provided for doing exactly that?

Changed in xorg (Ubuntu):
status: Invalid → Confirmed
Revision history for this message
Brett Johnson (linuxturtle) wrote :

This bug has been reported over and over again since it was introduced in 12.04 (just do a LP search for "Maximum number of clients reached"). Now, for some reason in 15.10 it's much easier to reproduce. I hit the problem every day now, whereas I used to be able to go a couple weeks without hitting it. There are many clues in the older reports:

https://bugs.launchpad.net/ubuntu/+source/gnome-screensaver/+bug/263211 seems to have gotten the most attention, and was closed with changes to gnome-screensaver, but I don't think that actually fixed the problem (just made gnome-screensaver quit making the problem show up). It seems to be some kind of X resource leak.

I don't know if this is relevant or helpful, but taking some of the comments from that bug report, here are some of the things folks did in that bug to troubleshoot:

xwininfo -root -children | wc -l

Over time, the resulting number keeps going up. It's currently at 430, and if I open a window (gcalc, for example), I'll get the "Maximum number of clients reached" error when trying to run xwininfo. If I look at the out put of xwininfo -root -children right before that, I see that about 80% of the windows have no name.

Also, if I run xrestop, I get a whole bunch of "<unknown>" resources with no associated PID (218 of them at the moment). The other 38 are actual windows I have open.

Revision history for this message
Brett Johnson (linuxturtle) wrote :

A little more info, as I've been trying to watch the output of xwininfo -root -children, as well as xrestop over time.

As I mentioned before, the number of root children keeps growing over time. It starts out under 100, and grows over time. When the "Maximum number of clients reached" problem started this time, it was at 322 (lower than last time). However, I also watched the output of "xrestop -m 1 -b | grep ^[0-9]" over time, and watched it grow from around 42, to 255 when the problem manifested itself (same as last time). I think this is more significant, because the 255 seems to be a cap, and it never goes higher than this. Is there an 8-bit table somewhere in X that if it fills up, could cause this syptom?

Revision history for this message
Brett Johnson (linuxturtle) wrote :

More info: This seems to be related to Unity, or at least, Unity makes the problem show up a lot faster. When running Unity, I'd see this problem every day. I switched to using gnome-shell for my desktop, and I've been up for a week now without ever encountering the problem.

Changed in xorg (Ubuntu):
importance: Undecided → Critical
Revision history for this message
Alberto Salvia Novella (es20490446e) wrote :

If you experience this bug using a different compositor than Compiz, please change the affected package back from "compiz" to "xorg".

affects: xorg (Ubuntu) → compiz (Ubuntu)
Changed in compiz:
status: New → Confirmed
Changed in compiz (Ubuntu):
status: Confirmed → Triaged
Changed in xorg (Ubuntu):
status: New → Invalid
importance: Undecided → Critical
Revision history for this message
Billy Barnes (webarnes) wrote :

I have been having this problem for a while. I have seen a number of commands suggested as helpful in various forums: `xwininfo -root -children`, `xlsclients`, and `lsof -U`. I wrote a script that logged the number of lines reported by these every 30 seconds.

It took about 5 days for my computer to crash (for most of which the computer was idle because I was away for the long weekend). xlsclients and lsof stayed steady at around 20 and 500 lines respectively. xwininfo climbed steadily from 68 to 362. When the computer was idle and locked, it would stay steady for hours at a time, then climb by about 10 windows over 5 minutes, then steady out again. As described by Brett Johnson above, most of the windows have no name.

I notice that it is always nautilus that crashes, usually while the computer is unattended. I will return, nautilus will be closed and I won't be able to open any new windows because the maximum number of clients is reached. Nautlius exits with a segfault some address "not located in known VMA region".

Revision history for this message
shemgp (shemgp) wrote :

Experienced this with Ubuntu 16.04 after using my work desktop station as a temporary server with vagrant servers and using gnome-shell as my DE for about a month. Nautilus started to crash with the error:

cannot open display: :0.0
Maximum number of clients reached

Restarting gdm3 didn't work either. Killed all users, and run startx as root launched the gnome-shell and nautilus worked, but I could not make gdm3 start as gdm3 user again.

Changed in xorg (Ubuntu):
status: Invalid → Confirmed
affects: xorg (Ubuntu) → xorg-server (Ubuntu)
tags: added: xenial
Revision history for this message
Dzh (dzhuneyt) wrote :

Also experiencing this currently on Ubuntu 16.04.5 LTS.

After working on the computer for a few hours, I can no longer open any application (Nautilus, Terminal, etc).

If I already had a terminal open before the issue occurs and I try to start nautilus from this old terminal, I get the following error:

Maximum number of clients reached
** (nautilus:29162): WARNING **: Could not open X display
sys:1: PyGIWarning: Nautilus was imported without specifying a version first. Use gi.require_version('Nautilus', '3.0') before import to ensure that the right version gets loaded.
/usr/share/nautilus-python/extensions/nautilus-admin.py:18: PyGIWarning: GConf was imported without specifying a version first. Use gi.require_version('GConf', '2.0') before import to ensure that the right version gets loaded.
  from gi.repository import Nautilus, GObject, GConf, Gtk, GLib
** Message: Init Stock Icons
Maximum number of clients reached
(nautilus:29162): GnomeDesktop-WARNING **: Unable to open display ':1' when setting background pixmap

Segmentation fault (core dumped)

I tried all possible solutions that were provided by Google but nothing worked. Restarting the system or closing half of the opened applications (e.g. Chrome tabs) seems to resolve the issue temporarily, but this is not really a solution but a workaround.

Revision history for this message
Rui Baeta (rui-baeta) wrote :

Hi there!

Same problem here...

A simple search in the Internet and found several threads about this problem and it seems no one is interested on fixing this... and it is very disappointing to see that this issue is still opened... I'm not an expert in xserver but this seems like a really simple fix in a variable MAXCLIENTS...

I know that an increase in a variable limit may have an impact in system resources, but nowadays every medium laptop should be able to handle such an increase in resource consumption.

My laptop setup is:
 System: Ubuntu 18.04.3 LTS
 Memory: 31,1 GiB
 Processor: Intel Core i7-7820HQ CPU @ 2.90GHz × 8
 Graphics: Intel HD Graphics 630 (Kaby Lake GT2)
 GNOME: 3.28.2
 OS type: 64-bit
 Disk: 491,2 GB

which is pretty much common in development working environments, so it's just not acceptable such an limitation like this.

Please fix this or provide instructions to increase this limit in config files.


a59ff5 (a59ff5a59ff5)
Changed in xorg-server (Ubuntu):
status: Confirmed → Fix Released
Changed in compiz (Ubuntu):
status: Triaged → Fix Released
Changed in compiz:
status: Confirmed → Fix Released
Colin Watson (cjwatson)
Changed in xorg-server (Ubuntu):
status: Fix Released → Confirmed
Changed in compiz:
status: Fix Released → Confirmed
Changed in compiz (Ubuntu):
status: Fix Released → Triaged
tags: added: bionic
removed: wily
summary: - "Maximum number of clients reached", new in Ubuntu 15.10
+ "Maximum number of clients reached"
Changed in xorg-server (Ubuntu):
importance: Critical → High
Changed in compiz (Ubuntu):
importance: Critical → High
To post a comment you must log in.