Re: Hitting X limit in launching maximum number of vkcube instances
Hi Olivier, Thanks for experimenting on your end to rule out any X server issues. I was able to match your results and launch 512 instances of vkcube after making sure that Xserver (1.21.1.8) has inherited the higher "max open files" limit. I really appreciate help from you, Adam and Alan. Anuj On Wed, Aug 16, 2023 at 12:46 AM Olivier Fourdan wrote: > > Hi Anuj, > > On Mon, Aug 14, 2023 at 8:27 PM Anuj Phogat wrote: >> >> - I'm still getting the "_XSERVTransSocketUNIXAccept: accept() failed" error >> after launching ~ 256 instances of vkcube. I was able to find the root >> cause of error after patching libxtrans based on Adam's suggestion: >> "_XSERVTransSocketUNIXAccept: accept() failed (Too many open files)" >> - Based on the hint from the error string, I changed the system wide limit to >> increase the maximum number of open files allowed from default 1024 to >> 'ulimit -n' confirmed the new limit. But, this change doesn't change >> the error past launching ~ 256 instances of vkcube. >> - I hit the same error but at ~330 instances when I try to run glxgears. >> >> Questions: >> What am I missing when changing the open files limit ? > > > Make sure the X process has inherited that limit, depending on how/where you > bumped the limit, the X server process may not have that applied. > > You can check using the /proc filesystem on Linux: > > $ cat /proc/$(pidof Xorg)/limits > >> What else can I try to get past this error ? > > > If you can get 330 instances of glxgears, it means that you are already past > the 256 limit, hence the maxclients worked. > > It is worth noting that the limit applies to all X11 clients, so if you run a > window manager, an xterm, etc, everything counts. > > Also if a client opens more than one connection to the X server, that also > counts. So you can expect that a limit of 512 might give you a lower actual > limit. > >> >> Should I reopen xserver issue [1] or create a new issue to track it ? > > > I doubt that this is an X server issue. > > FWIW, I just tried here with Xwayland rootful and was able to run 474 > instances of vkcube on a rootful stanlone Xwayland instance: > > $ Xwayland -maxclients 512 -decorate :12 7 > $ for i in $(seq 1 512); do DISPLAY=:12 vkcube& done > $ ps aux | grep vkcube | wc -l > 474 > > I have seen some "Maximum number of clients reached" errors while the vkcube > instances were spawning en masse, so I suspect maybe the vulkan > implementation is opening a connection to the display for some reason > temporarily, so having those start all at once may lead to a lower actual > limit of clients.. > > To confirm that theory, I dedid the same test waiting a bit between each > instance of vkcube. > > And nowI can reach the limit of 512: > > $ for i in $(seq 1 512); do DISPLAY=:12 vkcube; sleep .2 & done > $ ps aux | grep vkcube | wc -l > 512 > > So yeah, no bug in the Xserver AFAICS. > > This is with: > > $ cat /proc/$(pidof Xwayland)/limits > Limit Soft Limit Hard Limit Units > Max cpu time unlimitedunlimitedseconds > Max file size unlimitedunlimitedbytes > Max data size unlimitedunlimitedbytes > Max stack size8388608 unlimitedbytes > Max core file sizeunlimitedunlimitedbytes > Max resident set unlimitedunlimitedbytes > Max processes 6231962319processes > Max open files16777216 16777216 files > Max locked memory 8388608 8388608 bytes > Max address space unlimitedunlimitedbytes > Max file locksunlimitedunlimitedlocks > Max pending signals 6231962319signals > Max msgqueue size 819200 819200 bytes > Max nice priority 00 > Max realtime priority 00 > Max realtime timeout unlimitedunlimitedus > >> [1] : https://gitlab.freedesktop.org/xorg/xserver/-/issues/1310 > > > Cheers > Olivier > >
Re: Hitting X limit in launching maximum number of vkcube instances
Hi Olivier, Adam My apologies for the delayed response. I was pulled into something more urgent. Listing down my findings after experimentation based on your suggestions: - I was earlier using x server version 1.21.1.4. I recently upgraded the version to 1.21.1.8. This upgrade fixed issues (dead windows and rendering) with launching kcalc instances past the 256 default max client limit. I tested launching 300 kcalc instances. - I'm still getting the "_XSERVTransSocketUNIXAccept: accept() failed" error after launching ~ 256 instances of vkcube. I was able to find the root cause of error after patching libxtrans based on Adam's suggestion: "_XSERVTransSocketUNIXAccept: accept() failed (Too many open files)" - Based on the hint from the error string, I changed the system wide limit to increase the maximum number of open files allowed from default 1024 to 'ulimit -n' confirmed the new limit. But, this change doesn't change the error past launching ~ 256 instances of vkcube. - I hit the same error but at ~330 instances when I try to run glxgears. Questions: What am I missing when changing the open files limit ? What else can I try to get past this error ? Should I reopen xserver issue [1] or create a new issue to track it ? [1] : https://gitlab.freedesktop.org/xorg/xserver/-/issues/1310 Thanks Anuj On Tue, May 23, 2023 at 1:41 AM Olivier Fourdan wrote: > > Hi > > On Thu, May 18, 2023 at 10:45 AM Anuj Phogat wrote: > > > > On Sat, May 6, 2023 at 9:04 AM Alan Coopersmith > > wrote: > > > > > > On 5/5/23 16:07, Anuj Phogat wrote: > > > > Thanks for the quick response Adam. I've seen this behavior across > > > > multiple > > > > graphics applications > > > > and graphics drivers. This is an extreme use case I'm trying out. So, > > > > there's a > > > > possibility of this use > > > > case not being handled correctly by any of the applications or graphics > > > > drivers. > > > > But I also see some basic X functionality, like closing the window > > > > using the "x" > > > > button, not working > > > > properly with windows opened past the 256 limit. This happens with a > > > > modified > > > > limit of 512. I had to > > > > use xkill to close those windows. Any thoughts about this? > > > > > > Closing the window with the "x" button is a function of the window > > > manager. > > > Does the window manager you are using assume the number of X clients is > > > limited to 256? That xkill works suggests the X server is handling it > > > correctly. > > Alan, I took the window manager out of the equation by running multiple > > instances of vkcube with Xorg without running any window manager. > > Xorg.0.log file does show a log about set max clients through a .conf file: > > (**) Option "MaxClients" "512" > > > > But, I start seeing below error messages at the end of the log file once > > the number of vkcube instances go past 256: > > "_XSERVTransSocketUNIXAccept: accept() failed" > > > > Seems like the modified max clients limit of 512 is not getting configured > > correctly in X. > > > > What can I do to fix / debug this error ? > > I didn't find a mention of the actual version of the Xserver you're > running (not knowing what Ubuntu ships), but this may be relevant for > your issue: > > https://gitlab.freedesktop.org/xorg/xserver/-/issues/1310 > > Fixed with: > > https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/937 > > And backported to the 21.1 branch with: > > https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/953 > > HTH > > Cheers > > Olivier >
Re: Hitting X limit in launching maximum number of vkcube instances
Hi Anuj, On Mon, Aug 14, 2023 at 8:27 PM Anuj Phogat wrote: > - I'm still getting the "_XSERVTransSocketUNIXAccept: accept() failed" > error > after launching ~ 256 instances of vkcube. I was able to find the root > cause of error after patching libxtrans based on Adam's suggestion: > "_XSERVTransSocketUNIXAccept: accept() failed (Too many open files)" > - Based on the hint from the error string, I changed the system wide limit > to > increase the maximum number of open files allowed from default 1024 to > 'ulimit -n' confirmed the new limit. But, this change doesn't change > the error past launching ~ 256 instances of vkcube. > - I hit the same error but at ~330 instances when I try to run glxgears. > > Questions: > What am I missing when changing the open files limit ? > Make sure the X process has inherited that limit, depending on how/where you bumped the limit, the X server process may not have that applied. You can check using the /proc filesystem on Linux: $ cat /proc/$(pidof Xorg)/limits What else can I try to get past this error ? > If you can get 330 instances of glxgears, it means that you are already past the 256 limit, hence the maxclients worked. It is worth noting that the limit applies to all X11 clients, so if you run a window manager, an xterm, etc, everything counts. Also if a client opens more than one connection to the X server, that also counts. So you can expect that a limit of 512 might give you a lower actual limit. > Should I reopen xserver issue [1] or create a new issue to track it ? > I doubt that this is an X server issue. FWIW, I just tried here with Xwayland rootful and was able to run 474 instances of vkcube on a rootful stanlone Xwayland instance: $ Xwayland -maxclients 512 -decorate :12 7 $ for i in $(seq 1 512); do DISPLAY=:12 vkcube& done $ ps aux | grep vkcube | wc -l 474 I have seen some "Maximum number of clients reached" errors while the vkcube instances were spawning en masse, so I suspect maybe the vulkan implementation is opening a connection to the display for some reason temporarily, so having those start all at once may lead to a lower actual limit of clients.. To confirm that theory, I dedid the same test waiting a bit between each instance of vkcube. And nowI can reach the limit of 512: $ for i in $(seq 1 512); do DISPLAY=:12 vkcube; sleep .2 & done $ ps aux | grep vkcube | wc -l 512 So yeah, no bug in the Xserver AFAICS. This is with: $ cat /proc/$(pidof Xwayland)/limits Limit Soft Limit Hard Limit Units Max cpu time unlimitedunlimitedseconds Max file size unlimitedunlimitedbytes Max data size unlimitedunlimitedbytes Max stack size8388608 unlimitedbytes Max core file sizeunlimitedunlimitedbytes Max resident set unlimitedunlimitedbytes Max processes 6231962319 processes Max open files16777216 16777216 files Max locked memory 8388608 8388608 bytes Max address space unlimitedunlimitedbytes Max file locksunlimitedunlimitedlocks Max pending signals 6231962319signals Max msgqueue size 819200 819200 bytes Max nice priority 00 Max realtime priority 00 Max realtime timeout unlimitedunlimitedus [1] : https://gitlab.freedesktop.org/xorg/xserver/-/issues/1310 > Cheers Olivier
Re: Hitting X limit in launching maximum number of vkcube instances
Hi On Thu, May 18, 2023 at 10:45 AM Anuj Phogat wrote: > > On Sat, May 6, 2023 at 9:04 AM Alan Coopersmith > wrote: > > > > On 5/5/23 16:07, Anuj Phogat wrote: > > > Thanks for the quick response Adam. I've seen this behavior across > > > multiple > > > graphics applications > > > and graphics drivers. This is an extreme use case I'm trying out. So, > > > there's a > > > possibility of this use > > > case not being handled correctly by any of the applications or graphics > > > drivers. > > > But I also see some basic X functionality, like closing the window using > > > the "x" > > > button, not working > > > properly with windows opened past the 256 limit. This happens with a > > > modified > > > limit of 512. I had to > > > use xkill to close those windows. Any thoughts about this? > > > > Closing the window with the "x" button is a function of the window manager. > > Does the window manager you are using assume the number of X clients is > > limited to 256? That xkill works suggests the X server is handling it > > correctly. > Alan, I took the window manager out of the equation by running multiple > instances of vkcube with Xorg without running any window manager. > Xorg.0.log file does show a log about set max clients through a .conf file: > (**) Option "MaxClients" "512" > > But, I start seeing below error messages at the end of the log file once > the number of vkcube instances go past 256: > "_XSERVTransSocketUNIXAccept: accept() failed" > > Seems like the modified max clients limit of 512 is not getting configured > correctly in X. > > What can I do to fix / debug this error ? I didn't find a mention of the actual version of the Xserver you're running (not knowing what Ubuntu ships), but this may be relevant for your issue: https://gitlab.freedesktop.org/xorg/xserver/-/issues/1310 Fixed with: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/937 And backported to the 21.1 branch with: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/953 HTH Cheers Olivier
Re: Hitting X limit in launching maximum number of vkcube instances
On Sat, May 6, 2023 at 9:04 AM Alan Coopersmith wrote: > > On 5/5/23 16:07, Anuj Phogat wrote: > > Thanks for the quick response Adam. I've seen this behavior across multiple > > graphics applications > > and graphics drivers. This is an extreme use case I'm trying out. So, > > there's a > > possibility of this use > > case not being handled correctly by any of the applications or graphics > > drivers. > > But I also see some basic X functionality, like closing the window using > > the "x" > > button, not working > > properly with windows opened past the 256 limit. This happens with a > > modified > > limit of 512. I had to > > use xkill to close those windows. Any thoughts about this? > > Closing the window with the "x" button is a function of the window manager. > Does the window manager you are using assume the number of X clients is > limited to 256? That xkill works suggests the X server is handling it > correctly. Alan, I took the window manager out of the equation by running multiple instances of vkcube with Xorg without running any window manager. Xorg.0.log file does show a log about set max clients through a .conf file: (**) Option "MaxClients" "512" But, I start seeing below error messages at the end of the log file once the number of vkcube instances go past 256: "_XSERVTransSocketUNIXAccept: accept() failed" Seems like the modified max clients limit of 512 is not getting configured correctly in X. What can I do to fix / debug this error ? > > -- > -Alan Coopersmith- alan.coopersm...@oracle.com > Oracle Solaris Engineering - https://blogs.oracle.com/solaris >
Re: Hitting X limit in launching maximum number of vkcube instances
I would start by figuring out exactly why accept() is failing. You could use strace for this, or a patch like: https://gitlab.freedesktop.org/ajax/libxtrans/-/commit/0cf78fc5b4156f0053a6a332f97b4652ed54cb6a Note that to make that patch work you need to patch libxtrans and then rebuild xserver against the result, xtrans is a header-only library. - ajax On Tue, May 16, 2023 at 7:21 PM Anuj Phogat wrote: > On Sat, May 6, 2023 at 9:04 AM Alan Coopersmith > wrote: > > > > On 5/5/23 16:07, Anuj Phogat wrote: > > > Thanks for the quick response Adam. I've seen this behavior across > multiple > > > graphics applications > > > and graphics drivers. This is an extreme use case I'm trying out. So, > there's a > > > possibility of this use > > > case not being handled correctly by any of the applications or > graphics drivers. > > > But I also see some basic X functionality, like closing the window > using the "x" > > > button, not working > > > properly with windows opened past the 256 limit. This happens with a > modified > > > limit of 512. I had to > > > use xkill to close those windows. Any thoughts about this? > > > > Closing the window with the "x" button is a function of the window > manager. > > Does the window manager you are using assume the number of X clients is > > limited to 256? That xkill works suggests the X server is handling it > > correctly. > Alan, I took the window manager out of the equation by running multiple > instances of vkcube with Xorg without running any window manager. > Xorg.0.log file does show a log about set max clients through a .conf file: > (**) Option "MaxClients" "512" > > But, I start seeing below error messages at the end of the log file once > the number of vkcube instances go past 256: > "_XSERVTransSocketUNIXAccept: accept() failed" > > Seems like the modified max clients limit of 512 is not getting configured > correctly in X. > > What can I do to fix / debug this error ? > > > > > > -- > > -Alan Coopersmith- alan.coopersm...@oracle.com > > Oracle Solaris Engineering - https://blogs.oracle.com/solaris > > > >
Re: Hitting X limit in launching maximum number of vkcube instances
On 5/5/23 16:07, Anuj Phogat wrote: Thanks for the quick response Adam. I've seen this behavior across multiple graphics applications and graphics drivers. This is an extreme use case I'm trying out. So, there's a possibility of this use case not being handled correctly by any of the applications or graphics drivers. But I also see some basic X functionality, like closing the window using the "x" button, not working properly with windows opened past the 256 limit. This happens with a modified limit of 512. I had to use xkill to close those windows. Any thoughts about this? Closing the window with the "x" button is a function of the window manager. Does the window manager you are using assume the number of X clients is limited to 256? That xkill works suggests the X server is handling it correctly. -- -Alan Coopersmith- alan.coopersm...@oracle.com Oracle Solaris Engineering - https://blogs.oracle.com/solaris
Re: Hitting X limit in launching maximum number of vkcube instances
Thanks for the quick response Adam. I've seen this behavior across multiple graphics applications and graphics drivers. This is an extreme use case I'm trying out. So, there's a possibility of this use case not being handled correctly by any of the applications or graphics drivers. But I also see some basic X functionality, like closing the window using the "x" button, not working properly with windows opened past the 256 limit. This happens with a modified limit of 512. I had to use xkill to close those windows. Any thoughts about this? Thanks Anuj On Fri, May 5, 2023 at 2:55 PM Adam Jackson wrote: > No, just MAXCLIENTS. Probably vkcube (or the driver it's using) should > fail more robustly when it can't connect to the display, instead of letting > you render without presenting though. > > On Fri, May 5, 2023 at 5:28 PM Anuj Phogat wrote: > >> Hi All, >> >> I've been trying to run the maximum number of instances of vkcube (Vulkan >> application) >> in Ubuntu 22.04. I'm hitting one of these X errors when I get past ~256 >> instances: >> - "Maximum number of clients reached" >> - "_XSERVTransSocketUNIXAccept: accept() failed" >> >> I was able to get past these errors by adding below code in xorg conf >> file passed to Xorg >> using '-config' option: >> Section "ServerFlags" >> Option "MaxClients" "512" >> EndSection >> >> Now I'm not seeing X errors about the limit but X windows past the 256 >> limit don't render >> anything. Do I need to adjust any other limits (other than MAXCLIENTS) to >> make instances >> past 256 limit render as expected ? I would appreciate any pointers to >> help me debug and >> resolve this issue. >> >> Adding Adam and Olivier in Cc as I noticed a few old patches from them >> around changing >> MAXCLIENTS. >> >> Thanks >> Anuj >> >
Re: Hitting X limit in launching maximum number of vkcube instances
No, just MAXCLIENTS. Probably vkcube (or the driver it's using) should fail more robustly when it can't connect to the display, instead of letting you render without presenting though. On Fri, May 5, 2023 at 5:28 PM Anuj Phogat wrote: > Hi All, > > I've been trying to run the maximum number of instances of vkcube (Vulkan > application) > in Ubuntu 22.04. I'm hitting one of these X errors when I get past ~256 > instances: > - "Maximum number of clients reached" > - "_XSERVTransSocketUNIXAccept: accept() failed" > > I was able to get past these errors by adding below code in xorg conf file > passed to Xorg > using '-config' option: > Section "ServerFlags" > Option "MaxClients" "512" > EndSection > > Now I'm not seeing X errors about the limit but X windows past the 256 > limit don't render > anything. Do I need to adjust any other limits (other than MAXCLIENTS) to > make instances > past 256 limit render as expected ? I would appreciate any pointers to > help me debug and > resolve this issue. > > Adding Adam and Olivier in Cc as I noticed a few old patches from them > around changing > MAXCLIENTS. > > Thanks > Anuj >