22

After some period of time, I'm experiencing problems with starting applications, for example, Viber.

$ /opt/viber/Viber
QSqlDatabasePrivate::removeDatabase: connection 'ConfigureDBConnection' is still in use, all queries will cease to work.
Maximum number of clients reached
(Viber:1279): Gtk-WARNING **: cannot open display: :0

Skype

$ skype
Maximum number of clients reached

Gnote

$ gnote
Maximum number of clients reached
** (gnote:21284): WARNING **: Could not open X display
Maximum number of clients reached
(gnote:21284): Gtk-WARNING **: cannot open display: :0

xrestop

$ xrestop
Maximum number of clients reachedxrestop: Unable to open display!

After some research, I've found that it is related to some limit of unix sockets.

$ lsof -U +c 15 | wc -l
1011


$ lsof -U +c 15 | cut -f1 -d' ' | sort | uniq -c | sort -rn | head -3
    382 zenity
    256 dbus-daemon
    212 chrome

On some sources people are talking about 256 max X client number limit. It looks like this is proved by the following command output:

# lsof -p `pidof X` | tail -n 50
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
Xorg    1672 root  207u     unix 0xffff880141189e00      0t0    3759941 @/tmp/.X11-unix/X0
Xorg    1672 root  208u     unix 0xffff88001a50a940      0t0    3759944 @/tmp/.X11-unix/X0
Xorg    1672 root  209u     unix 0xffff88003a0430c0      0t0    3802123 @/tmp/.X11-unix/X0
Xorg    1672 root  210u     unix 0xffff8801117c3c00      0t0    3817272 @/tmp/.X11-unix/X0
Xorg    1672 root  211u     unix 0xffff8801225e2580      0t0    4395710 @/tmp/.X11-unix/X0
Xorg    1672 root  212u     unix 0xffff88015ed3a580      0t0    4425629 @/tmp/.X11-unix/X0
Xorg    1672 root  213u     unix 0xffff88013095f800      0t0    4427059 @/tmp/.X11-unix/X0
Xorg    1672 root  214u     unix 0xffff8802e75d9a40      0t0    4427075 @/tmp/.X11-unix/X0
Xorg    1672 root  215u     unix 0xffff8801225e12c0      0t0    4608310 @/tmp/.X11-unix/X0
Xorg    1672 root  216u     unix 0xffff88031bc8fbc0      0t0    4608314 @/tmp/.X11-unix/X0
Xorg    1672 root  217u     unix 0xffff8801309a5dc0      0t0    4608318 @/tmp/.X11-unix/X0
Xorg    1672 root  218u     unix 0xffff8801309a2940      0t0    4607747 @/tmp/.X11-unix/X0
Xorg    1672 root  219u     unix 0xffff880130958b40      0t0    4786413 @/tmp/.X11-unix/X0
Xorg    1672 root  220u     unix 0xffff8800b1382d00      0t0    4787103 @/tmp/.X11-unix/X0
Xorg    1672 root  221u     unix 0xffff88011f350000      0t0    5001136 @/tmp/.X11-unix/X0
Xorg    1672 root  222u     unix 0xffff88011f352d00      0t0    5144089 @/tmp/.X11-unix/X0
Xorg    1672 root  223u     unix 0xffff88011f351a40      0t0    5144417 @/tmp/.X11-unix/X0
Xorg    1672 root  224u     unix 0xffff88011f357bc0      0t0    5145648 @/tmp/.X11-unix/X0
Xorg    1672 root  225u     unix 0xffff88014108a940      0t0    5145652 @/tmp/.X11-unix/X0
Xorg    1672 root  226u     unix 0xffff88001a50c740      0t0    5145655 @/tmp/.X11-unix/X0
Xorg    1672 root  227u     unix 0xffff88006c7b6cc0      0t0    5161703 @/tmp/.X11-unix/X0
Xorg    1672 root  228u     unix 0xffff8802e75dddc0      0t0    5225428 @/tmp/.X11-unix/X0
Xorg    1672 root  229u     unix 0xffff88015ed3cb00      0t0    5228455 @/tmp/.X11-unix/X0
Xorg    1672 root  230u     unix 0xffff880111b203c0      0t0    5235401 @/tmp/.X11-unix/X0
Xorg    1672 root  231u     unix 0xffff88013089bfc0      0t0    5259828 @/tmp/.X11-unix/X0
Xorg    1672 root  232u     unix 0xffff8800b10030c0      0t0    5310616 @/tmp/.X11-unix/X0
Xorg    1672 root  233u     unix 0xffff88010d461e00      0t0    5349971 @/tmp/.X11-unix/X0
Xorg    1672 root  234u     unix 0xffff88001a50ddc0      0t0    5530781 @/tmp/.X11-unix/X0
Xorg    1672 root  235u     unix 0xffff880142e703c0      0t0    5529146 @/tmp/.X11-unix/X0
Xorg    1672 root  236u     unix 0xffff880142e73c00      0t0    5654363 @/tmp/.X11-unix/X0
Xorg    1672 root  237u     unix 0xffff88025087f800      0t0    5260838 @/tmp/.X11-unix/X0
Xorg    1672 root  238u     unix 0xffff880142e712c0      0t0    5814164 @/tmp/.X11-unix/X0
Xorg    1672 root  239u     unix 0xffff8802508a21c0      0t0    5917312 @/tmp/.X11-unix/X0
Xorg    1672 root  240u     unix 0xffff8800b1387080      0t0    5851281 @/tmp/.X11-unix/X0
Xorg    1672 root  241u     unix 0xffff8802e6854380      0t0    5851284 @/tmp/.X11-unix/X0
Xorg    1672 root  242u     unix 0xffff88011f3503c0      0t0    5851295 @/tmp/.X11-unix/X0
Xorg    1672 root  243u     unix 0xffff8801041d8f00      0t0    5917315 @/tmp/.X11-unix/X0
Xorg    1672 root  244u     unix 0xffff8801041d83c0      0t0    5917322 @/tmp/.X11-unix/X0
Xorg    1672 root  245u     unix 0xffff88000aeb4ec0      0t0    5917325 @/tmp/.X11-unix/X0
Xorg    1672 root  246u     unix 0xffff880111b21e00      0t0    5993474 @/tmp/.X11-unix/X0
Xorg    1672 root  247u     unix 0xffff880143546180      0t0    6115119 @/tmp/.X11-unix/X0
Xorg    1672 root  248u     unix 0xffff88000aeb30c0      0t0    6120777 @/tmp/.X11-unix/X0
Xorg    1672 root  249u     unix 0xffff88013089da00      0t0    6119223 @/tmp/.X11-unix/X0
Xorg    1672 root  250u     unix 0xffff8801309a5280      0t0    6121614 @/tmp/.X11-unix/X0
Xorg    1672 root  251u     unix 0xffff88000aeb6cc0      0t0    6139354 @/tmp/.X11-unix/X0
Xorg    1672 root  252u     unix 0xffff88010d460000      0t0    6635385 @/tmp/.X11-unix/X0
Xorg    1672 root  253u     unix 0xffff88013095b840      0t0    6659213 @/tmp/.X11-unix/X0
Xorg    1672 root  254u     unix 0xffff88005c96b480      0t0    6661835 @/tmp/.X11-unix/X0
Xorg    1672 root  255u     unix 0xffff88011f350f00      0t0    6710815 @/tmp/.X11-unix/X0
Xorg    1672 root  256u      REG               0,16     4096      22306 /sys/devices/pci0000:00/0000:00:02.0/drm/card1/card1-LVDS-1/intel_backlight/brightness

I can close some application, for example, Chrome and then Viber can be started.

I'm wondering if this is normal to have 200+ connections for the top three apps? Or just suggest how to solve the problem, please.

Note, I can use my system for months without rebooting (suspend/resume).

Linux Mint 17.3 64-bit Cinnamon

3
  • Can you cite the research you are referring to? May 30, 2017 at 5:57
  • I think, this one askubuntu.com/questions/4499/…
    – humkins
    May 30, 2017 at 6:28
  • Unbelievable, this just happened to me with ysoft-client-kde appearing 898 times, preventing anything else from running. Apr 3, 2019 at 7:06

2 Answers 2

21

I've found how to fix it situationally.

Following command made a hint for me

$ lsof -U +c 15 | cut -f1 -d' ' | sort | uniq -c | sort -rn | head -3
    382 zenity
    256 dbus-daemon
    212 chrome

I've took the top process name and have read little about it. From Wikipedia

Zenity is free software and a cross-platform program that allows the execution of GTK+ dialog boxes in command-line and shell scripts.

Then I've listed processes and filtered them by zenity key

$ ps axwwu | grep -i zenity
tom       762  0.0  0.2 390752 27476 ?        Sl   Jun06   0:01 /usr/bin/zenity --notification --window-icon /usr/share/icons/gnome/32x32/status/mail-unread.png --text You have new mail
tom      1239  0.0  0.2 390756 27700 ?        Sl   Jun06   0:01 /usr/bin/zenity --notification --window-icon /usr/share/icons/gnome/32x32/status/mail-unread.png --text You have new mail
tom      1249  0.0  0.2 390760 27752 ?        Sl   Jun02   0:01 /usr/bin/zenity --notification --window-icon /usr/share/icons/gnome/32x32/status/mail-unread.png --text You have new mail
...

Aha! This is related to mail notification toasts

$ pidof zenity | wc -w
186

$ killall zenity

$ pidof zenity | wc -w
0

$ lsof -U +c 15 | cut -f1 -d' ' | sort | uniq -c | sort -rn | head -3
    140 chrome
     61 dbus-daemon
     37 skypeforlinux

# lsof -p `pidof X` | tail -n 10
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
Xorg    1672 root   58u     unix 0xffff8801c05221c0      0t0    9714900 @/tmp/.X11-unix/X0
Xorg    1672 root   59u     unix 0xffff8801c0527440      0t0    9715809 @/tmp/.X11-unix/X0
Xorg    1672 root   62u      CHR              13,79      0t0    9540231 /dev/input/event15
Xorg    1672 root   69u     unix 0xffff88031c155280      0t0     175280 @/tmp/.X11-unix/X0
Xorg    1672 root   79u     unix 0xffff880063b103c0      0t0    9243076 @/tmp/.X11-unix/X0
Xorg    1672 root   90u     unix 0xffff880111b22940      0t0    2858278 @/tmp/.X11-unix/X0
Xorg    1672 root   96u     unix 0xffff88000aeb2d00      0t0    9301134 @/tmp/.X11-unix/X0
Xorg    1672 root  113u     unix 0xffff880063b14b00      0t0     939782 @/tmp/.X11-unix/X0
Xorg    1672 root  153u     unix 0xffff880111a47080      0t0    1819503 @/tmp/.X11-unix/X0
Xorg    1672 root  256u      REG               0,16     4096      22306 /sys/devices/pci0000:00/0000:00:02.0/drm/card1/card1-LVDS-1/intel_backlight/brightness

# lsof -p `pidof X` | wc -l
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
      Output information may be incomplete.
524

Voilà! I can start other apps now (until zenity or another buggy app eats all available connections).

NOTE. I still will have to sort how to prevent zenity to keep connections

2
  • 1
    Looks like, you have lots of zombie processes. But why you have connection in the first place? zenity just forgets to close connections? Jun 24, 2017 at 11:27
  • 1
    Yes, Dmitry, it looks like it does forget.
    – humkins
    Jun 24, 2017 at 13:57
2

I believe that the fundamental problem is the number of allowed open file handles by Xorg. I hit this problem recently even with recently started applications as more and more applications are making X client connections.

My solution to passing arguments to Xorg when no configuration files (/etc) seem to support passing options to the server was to mv /bin/Xorg /bin/Xorg.real and then to create a new /bin/Xorg wrapper with this in it:

#!/bin/bash

exec /usr/bin/Xorg.real -maxclients 2048 "$@"

This should work, as the running command line options now do include the increased -maxclients flag, up from the default 1024.

Another potential cause but doesn't work:

My older solution [doesn't work] was to change the soft open file limit in /etc/security/limits.conf from the default of 1024 to 4096 or so. For example:

* soft nofile 4096

To provide this benefit to all users.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .