[Xcb] [Bug 51648] New: xcb calls read(2) to test data availability on xorg sockets instead of polling on FreeBSD

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Jul 2 02:38:14 PDT 2012


https://bugs.freedesktop.org/show_bug.cgi?id=51648

             Bug #: 51648
           Summary: xcb calls read(2) to test data availability on xorg
                    sockets instead of polling on FreeBSD
    Classification: Unclassified
           Product: XCB
           Version: unspecified
          Platform: x86-64 (AMD64)
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Library
        AssignedTo: xcb at lists.freedesktop.org
        ReportedBy: yuri at tsoft.com
         QAContact: xcb at lists.freedesktop.org


When I ran DTrace script showing all syscall failures, I noticed that FreeBSD
9.0 system is flooded with the failed read(2) requests reading from xorg
socket:
Resource temporarily unavailable
read failures mostly come from kdeinit4 process but also from kwin, chrome and
even Xorg itself. Rate of failure is ~2500/sec system wide.

Code analysis shows that requests originate from _xcb_in_read function from
this line:
int n = read(c->fd, c->in.queue + c->in.queue_len, sizeof(c->in.queue) -
c->in.queue_len);

I replaced this line with poll(2):
//int n = read(c->fd, c->in.queue + c->in.queue_len, sizeof(c->in.queue) -
c->in.queue_len);
    struct pollfd fds = {c->fd, POLLIN|POLLERR|POLLHUP, INFTIM};
    int n = poll(&fds, 1, INFTIM);

This causes the test qt4 app to hang because _xcb_in_read is sometimes called
when no actual data is expected from the xorg socket. Particularly,
_xcb_in_read is called from XFlush when no data is expected.

I am trying to understand the status of this code and this issue.
For example, is this a generic Xorg issue, does it, for example, exist in Linux
too, or it's FreeBSD only? It would look very amazing if Linux also has such
issue.

This is abnormal that Xorg code causes so many system call failures, at least
because this shortens the battery life and drains other resources.

libxcb-1.7

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.
You are the assignee for the bug.


More information about the Xcb mailing list