[Xcb] [Bug 29599] New: hang in xcb_request_check() due to expecting a reply on void request

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Aug 16 20:25:15 PDT 2010


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

           Summary: hang in xcb_request_check() due to expecting a reply
                    on void request
           Product: XCB
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: Misc
        AssignedTo: xcb at lists.freedesktop.org
        ReportedBy: hp at pobox.com
         QAContact: xcb at lists.freedesktop.org


If you do:

 - send a void request (no reply expected) with checked()
 - receive an event (which will have sequence number of void request)
 - DO NOT send another request
 - block for the request cookie

Then things will hang. What's supposed to happen (unless I'm confused) is that
xcb_request_check() does a GetInputFocus because the sequence number you're
checking is newer than the expected or completed:

 if(XCB_SEQUENCE_COMPARE_32(cookie.sequence,>,c->in.request_expected)
       && XCB_SEQUENCE_COMPARE_32(cookie.sequence,>,c->in.request_completed))
    {
        free(xcb_get_input_focus_reply(c, xcb_get_input_focus(c), &ret));

This then gets us a reply that proves the void request is complete and
read_packet can mark us complete.

What actually happens is this, in read_packet():
    if(XCB_SEQUENCE_COMPARE(c->in.request_read, >, c->in.request_expected))
            c->in.request_expected = c->in.request_read;

In this case the request_read sequence number matches that of the void request,
BUT it's just coming from an event, since events have the sequence number of
the last request.

xcb_request_check() now thinks a reply is coming for the void request, and
hangs forever.

I'm not sure of the exact correct fix; it worked for me avoid updating
request_expected if genrep.response_type == XCB_REPLY but I can also imagine
that it's correct to never update request_expected in this spot in read_packet.

Apps can work around the hang by manually doing their own GetInputFocus.

-- 
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