[Xcb] xcb recursive write not protected in all cases?

Keith Packard keithp at keithp.com
Mon Dec 23 21:23:18 PST 2013

Josh Triplett <josh at joshtriplett.org> writes:

> On Mon, Dec 23, 2013 at 05:00:46PM -0800, Keith Packard wrote:
>> I think we need to check out.writing closer to the actual use of the
>> out.queue; perhaps it would suffice to check that down inside
>> send_request itself? That would certainly offer the surest guarantee
>> that iolock wasn't dropped between the check for out.writing and the use
>> of out.queue.
> Based on your analysis, that sounds like the best plan indeed: check
> while holding the lock in send_request, where there's no way we can
> subsequently drop it before sending the request.

I ran into another issue in the same area -- while waiting for
out.writing, we can lose the socket back to Xlib, append some data to
the request buffer and then Xlib comes along and tries to write another
request to the socket and *bam* another assertion failure in write_vec.

I think we have to block until we have the socket *and* out.writing is

Something like this:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Ensure-send_request-can-allocate-a-sequence-number-a.patch
Type: text/x-diff
Size: 2360 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20131223/0795ac34/attachment.patch>
-------------- next part --------------

keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20131223/0795ac34/attachment.pgp>

More information about the Xcb mailing list