Package: xserver-xorg-input-wacom
Version: 0.26.0+20140918-1
Severity: important

I have a Wacom tablet, which was working fine with Wheezy. Recently I
installed Jessie and after a while, no more X applications would start
due to the error "Maximum number of clients reached". According to
https://lists.fedoraproject.org/pipermail/test/2009-May/081536.html this
error message can mean exactly what it says, or it can mean that X has
run out of file descriptors. In this case it was the latter, and it was
triggered by a bug in the xorg wacom input driver. Here's what the
problem looks like:

My Xorg process had a pid of 6087, and this command shows the number of
file descriptors for that PID:
root@saturn:~# ls /proc/6087/fd | wc -l
32
root@saturn:~#
After unplugging the tablet and then plugging it back in I got this:
root@saturn:~# ls /proc/6087/fd | wc -l
33
root@saturn:~#
After unplugging the tablet again and then plugging it back in I got
this:
root@saturn:~# ls /proc/6087/fd | wc -l
34
root@saturn:~#

And so on.... Every time the tablet was unplugged and plugged back in,
Xorg accumulated another file descriptor. Then when Xorg reached its
file descriptor limit it gave the "Maximum number of clients reached"
when attempting to start any additional programs. (Incidentally, it
didn't take very long for this to happen. I have my tablet connected
through a KVM switch, so every time I switched to my other computer and
then back again, that was equivalent to unplugging the tablet and then
plugging it back in.)

This bug was reported upstream at
http://sourceforge.net/p/linuxwacom/bugs/263/

It was fixed in version 0.28.0 by the commit debc8372. It's a very
simple commit--just moving one line a couple lines down:

diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index e6962dd..55b8b7c 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -753,9 +753,9 @@ static void wcmDevClose(InputInfoPtr pInfo)
 
        if (pInfo->fd >= 0)
        {
-               pInfo->fd = -1;
                if (!--common->fd_refs)
                        wcmClose(pInfo);
+               pInfo->fd = -1;
        }
 }

I confirmed that this solves the problem. I downloaded the
xf86-input-wacom Debian source package, manually moved that line as
shown above, built the Debian package, and installed it. Now when I
unplug and replug the tablet, it does not increase Xorg's file
descriptor count:
root@saturn:~# ls /proc/8228/fd | wc -l
32
root@saturn:~#
After unplugging the tablet and then plugging it back in I get this:
root@saturn:~# ls /proc/8228/fd | wc -l
32
root@saturn:~#
After unplugging the tablet and and then plugging it back in I get this:
root@saturn:~# ls /proc/8228/fd | wc -l
32
root@saturn:~#

I would like to recommend that this fix be added to the xorg wacom input
driver in Jessie. It certainly is frustrating to get that "Maximum
number of clients reached" error and not know why it's happening. I've
solved the problem for myself now, but including this trivial fix in
stable could potentially save a lot of frustration for other people.

Thank you,
James

Reply via email to