3

From time to time I get this message, I cant start application when this happens.

I've tried those links: Can't start applications due to “Maximum number of clients reached” error and How can I diagnose/debug "maximum number of clients reached" X errors? but I couldn't find a proper solution.

Some info: when running lsof -U +c 15 | cut -f1 -d' ' | sort | uniq -c | sort -rn | head -15 the result is:

109 dbus-daemon
 16 systemd
 15 gnome-shell
 12 ibus-daemon
 11 xdg-desktop-por
 11 nautilus
 11 gnome-session-b
 10 pulseaudio
 10 gnome-software
  9 x-terminal-emul
  8 gsd-media-keys
  7 update-notifier
  7 gsd-xsettings
  7 gsd-power
  7 gsd-keyboard

and this is when I have only one terminal open, nautilus file explorer, chrome (7 tabs), and blender.

My main suspect is dbus-daemon. My questions:

  1. How can I diagnose what causes dbus to behave like that?
  2. Is there a way to increas the limit? I have a quite strong machine and all...
  3. What to do? should I search in a different direction?

EDIT: after running uname -s -v -i -o I get: Linux #52~18.04.1-Ubuntu SMP Thu Sep 10 12:50:22 UTC 2020 x86_64 GNU/Linux

Lorenz Keel
  • 9,511
yossico
  • 131

1 Answers1

2

It is not related to the version of your software I think because I am having the same problem on Lubuntu 20.04.

I think I found a direction to 'solve' the issue 'Maximum number of clients reached' on https://unix.stackexchange.com/questions/498652/does-x-window-have-a-maximum-number-limit-on-clients.

In short what I did :

Find the maximum number of maxclients possible by the next command :

/usr/lib/xorg/Xorg -maxclients 1000000000

max maxclients is 2048 in my case ( has to be a power of 2 so 128, 256 etc. )

The next command needs to be executed as root because of filesystem security :

sudo -i 
printf 'Section "ServerFlags"\n\tOption "MaxClients" "512"\nEndSection\n' > /etc/X11/xorg.conf.d/99-maxclients.conf
exit

I installed a tool to monitor X related things :

sudo apt-get install xrestop

I also added the next 3 lines at the end of my ~/.bashrc :

function watchlsof { watch "lsof -U +c 15 | cut -f1 -d' ' | sort | uniq -c  | sort -rn | head -15" ; }
export -f watchlsof
echo "Use 'typeset -f | -F' to list functions"

So now I can monitor with the commands watchlsof and xrestop and maybe later increase the value in 99-maxclients.conf to 1024 or the highest value 2048

I hope this helps