由于“达到最大客户端数”错误而无法启动应用程序

hum*_*ins 9 xorg x11 linux-mint unix-sockets

一段时间后,我在启动应用程序时遇到问题,例如 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
Run Code Online (Sandbox Code Playgroud)

Skype

$ skype
Maximum number of clients reached
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

停止

$ xrestop
Maximum number of clients reachedxrestop: Unable to open display!
Run Code Online (Sandbox Code Playgroud)

经过一番研究,我发现它与unix套接字的某些限制有关。

$ 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
Run Code Online (Sandbox Code Playgroud)

在某些来源上,人们谈论最多 256 个 X 客户端数量限制。以下命令输出似乎证明了这一点:

# 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
Run Code Online (Sandbox Code Playgroud)

我可以关闭一些应用程序,例如 Chrome,然后可以启动 Viber。

我想知道前三个应用程序有 200 多个连接是否正常?或者只是建议如何解决问题,请。

请注意,我可以在不重新启动(暂停/恢复)的情况下使用我的系统数月。

Linux Mint 17.3 64 位 Cinnamon

hum*_*ins 9

我已经找到了如何根据情况解决它。

以下命令为我提供了提示

$ lsof -U +c 15 | cut -f1 -d' ' | sort | uniq -c | sort -rn | head -3
    382 zenity
    256 dbus-daemon
    212 chrome
Run Code Online (Sandbox Code Playgroud)

我采用了顶级进程名称,但对它的了解很少。来自维基百科

Zenity 是免费软件和跨平台程序,允许在命令行和 shell 脚本中执行 GTK+ 对话框。

然后我列出了进程并zenity按键过滤它们

$ 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
...
Run Code Online (Sandbox Code Playgroud)

啊哈!这与邮件通知吐司有关

$ 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
Run Code Online (Sandbox Code Playgroud)

瞧!我现在可以启动其他应用程序(直到 zenity 或其他有问题的应用程序占用所有可用连接)。

笔记。我仍然需要整理如何防止 zenity 以保持联系