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

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

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.

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

我已经使用.exe程序打开了102个窗口,并证明打开了5个窗口。对于 X 服务器来说窗口是否太多了?我该如何解决这个问题?

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

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

谢谢。

答案1

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.

并来自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.

默认值为 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;

您可以NextAvailableClient()入住dix/dispatch.cAllocNewConnection()os/connection.c了解所有详细信息。


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

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

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

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

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

相关内容