The X server code is assuming that one file descriptor is opened per client in os/connection.c , so it limits the number of file descriptors to the number of clients.
Unfortunately Xwayland opens a lot more file descriptors than a regular X server because of those "weston-shared-XXXXXX" anonymous files for sharing buffers.
The number of /extra/ file descriptors opened depends on the client so the actual limit depends on what application is running.
Once the X server (Xwayland) reaches the number of file descriptors opened, it will raise a "Maximum number of clients reached" even if the actual number of clients is a lot less that the expected limit.
Follow-up patch send to the ML for further review/discussion:
diff --git a/hw/xwayland/xwayland-shm.c b/hw/xwayland/xwayland-shm.c
index 2d0ce3e..1022c0d 100644
@@ -82,7 +82,7 @@ create_tmpfile_cloexec(char *tmpname)
- return fd;
+ return os_move_fd(fd);
as a shor term fix.
(In reply to Chris Wilson from comment #2)
> - return fd;
> + return os_move_fd(fd);
Or right, that's much better, thanks!
> as a shor term fix.
Why just a short term fix? it looks perfectly spot on to me...
BTW, do you mind if I resend a patch as a follow-up to the ML with your solution with you as author and your signed-off-by?
(In reply to Olivier Fourdan from comment #3)
> (In reply to Chris Wilson from comment #2)
> > Try
> > [...]
> > - return fd;
> > + return os_move_fd(fd);
> Or right, that's much better, thanks!
> > as a shor term fix.
> Why just a short term fix? it looks perfectly spot on to me...
I thought you had scenarios requiring more than 256 clients. Certainly seems conceivable that we will run out.
If that works for you send it on with
Signed-off-by: Chris Wilson <email@example.com>
and your Reported-and-tested-by.
(In reply to Chris Wilson from comment #5)
> If that works for you send it on with
> Signed-off-by: Chris Wilson <firstname.lastname@example.org>
> and your Reported-and-tested-by.
Done here: http://lists.x.org/archives/xorg-devel/2015-June/046722.html
Fix has been merged in git by Keith, closing.