X-Window 对客户端有最大数量限制吗?

Tim*_*Tim 5 x11 x-server

X-Window 对客户端有最大数量限制吗?

例如,您可以使用 Windows 创建“无限”数量的 evince 进程吗?如果没有,限制在哪里?

再举一个例子(虽然我将在下面使用 wine 客户端作为例子,我认为答案可能取决于也可能不取决于 X 客户端是否与 wine 相关),在 Lubuntu 18.04

 $ evince my.pdf 
Maximum number of clients reachedUnable to init server: Could not connect: Connection refused
Cannot parse arguments: Cannot open display: 

$ wine PDFXCview.exe my.pdf 
047d:fixme:ver:GetCurrentPackageId (0x32fbc4 (nil)): stub
Maximum number of clients reached047d:err:winediag:x11drv_init_thread_data x11drv: Can't open display: :0. Please ensure that your X server is running and that $DISPLAY is set correctly.
Run Code Online (Sandbox Code Playgroud)

关闭一些窗口(.exe 程序的窗口或 evince 窗口)后,我可以打开新窗口(对于其他 pdf 文件)。

我用.exe程序打开了102个窗口,evince打开了5个窗口。X 服务器的窗口是否太多?我该如何解决问题?

我可以提高最大数量限制吗?是否有一些限制客户端数量的配置设置?我该如何重新配置​​它?

我阅读了https://askubuntu.com/questions/4499/how-can-i-diagnose-debug-maximum-number-of-clients-reached-x-errorsx-clients 的最大数量是多少?,但仍然无法弄清楚我的问题。

谢谢。

mos*_*svy 8

来自xorg.conf(5)

SERVERFLAGS SECTION
    ...
    Option "MaxClients"  "integer"
        Set  the  maximum  number of clients allowed to connect to the X
        server.  Acceptable values are 64, 128, 256 or 512.
Run Code Online (Sandbox Code Playgroud)

来自Xserver(1)

-maxclients
      64|128|256|512  Set  the  maximum  number of clients allowed to
      connect to the X server.  Acceptable values are 64, 128, 256 or 512.
Run Code Online (Sandbox Code Playgroud)

默认值为 256,但在最新版本的 X 服务器中可以提高到 2048:

./include/misc.h:#define MAXCLIENTS       2048
./include/misc.h:#define LIMITCLIENTS   256     /* Must be a power of 2 and <= MAXCLIENTS */
./os/osinit.c:int LimitClients = LIMITCLIENTS;
Run Code Online (Sandbox Code Playgroud)

您可以检查NextAvailableClient()dix/dispatch.c,并AllocNewConnection()os/connection.c所有的细节。


在许多 linux 发行版上,您可以使用它来将客户端限制设置为 512:

# printf 'Section "ServerFlags"\n\tOption "MaxClients" "512"\nEndSection\n' \
        > /etc/X11/xorg.conf.d/99-maxclients.conf
Run Code Online (Sandbox Code Playgroud)

尝试以非常大的方式运行Xorg二进制文件(真正的二进制文件,而不是Xorg.wrap-maxclients会告诉您它支持该选项的哪些值:

/usr/lib/xorg/Xorg -maxclients 1000000000
...
(EE) maxclients must be one of 64, 128, 256, 512, 1024 or 2048
Run Code Online (Sandbox Code Playgroud)

可以通过X-Resource扩展获取实际连接到显示器的客户端数量;xrestop是一个应用程序,利用它以类似top的方式显示 X11 客户端及其正在使用的资源。

  • 请参阅 [此更改](https://cgit.freedesktop.org/xorg/xserver/commit/?id=d206c240c0b85c4da44f073d6e9a692afb6b96d2) 和 https://bugs.freedesktop.org/show_bug.cgi?id=9209 (2认同)