X11 - X client数量达到上限并报错Maximum number of clients reachedxlsclients
Posted 王万林 Ben
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了X11 - X client数量达到上限并报错Maximum number of clients reachedxlsclients相关的知识,希望对你有一定的参考价值。
X11 - X client数量达到上限并报错Maximum number of clients reachedxlsclients
报错
thesre@HP-Z420-Workstation:~$ xlsclients
Maximum number of clients reachedxlsclients: unable to open display ":0"
定位
看报错是X client数量达到上限了,我们来看下当前X server打开了多少X client。
thesre@HP-Z420-Workstation:~$ xlsclients
Maximum number of clients reachedxlsclients: unable to open display ":0"
执行xlsclients
无法查看,同上面一样提示达到上限的报错。我们关掉一个X client再查看下,
thesre@HP-Z420-Workstation:~$ xlsclients | head -5
HP-Z420-Workstation gnome-shell
HP-Z420-Workstation ibus-x11
HP-Z420-Workstation ibus-extension-gtk3
HP-Z420-Workstation gsd-keyboard
HP-Z420-Workstation gsd-color
thesre@HP-Z420-Workstation:~$ xlsclients | wc -l
243
可以看到X client的数量达到了243个。而X server的上限默认值为256个,这个值已经接近上限了。(至于打开X Client数量到244后就不能继续打开了,未找到相关资料,也欢迎知道的读者帮忙补充一下,谢谢!)
解决
关闭一些不使用的X Client来释放一些,以便能打开新的X Client。
进一步了解
我们再看下这个数值是在哪里定义的。
man xorg
xorg的配置可从多处获取,其中配置文件是xorg.conf
,接下来查看手册,
man 5 xorg.conf
如果需要配置MaxClient,则需要创建/etc/X11/xorg.conf文件,并在SERVERFLAGS SECTION下配置MacClients的配置。需要注意的是,该值必须是2的指数,可选的值有64,128,256和512。
实验
使用for循环试图一次性打开256个xclock:
thesre@HP-Z420-Workstation:~/Desktop$ for i in {1..256}; do echo $i; (xclock &); done
1
2
3
...snippet ommited...
239
240
241
Maximum number of clients reachedMaximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
242
Maximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
Error: Can't open display: :0
Maximum number of clients reachedMaximum number of clients reachedError: Can't open display: :0
Error: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedMaximum number of clients reachedMaximum number of clients reachedError: Can't open display: :0
Error: Can't open display: :0
Error: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
Maximum number of clients reached243
Error: Can't open display: :0
244
245
...snippet ommited...
255
256
thesre@HP-Z420-Workstation:~/Desktop$ Maximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedMaximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedMaximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
Error: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedMaximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
Error: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
Maximum number of clients reachedError: Can't open display: :0
Error: Can't open display: :0
参考资料
https://unix.stackexchange.com/a/515786/287317
以上是关于X11 - X client数量达到上限并报错Maximum number of clients reachedxlsclients的主要内容,如果未能解决你的问题,请参考以下文章
VUE中页面F5刷新空白并报错报错:Uncaught SyntaxError: Unexpected token <解决方法