<div class="gmail_quote">2010/12/1 Josh Triplett <span dir="ltr"><<a href="mailto:josh@joshtriplett.org">josh@joshtriplett.org</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">> It seems that the drawing thread is suck on the poll and waiting for a<br>
> reply, while the input thread is actually reading data from the socket.<br>
> This causes the above deadlock.<br>
<br>
</div>Strange. Obviously this *shouldn't* happen. :)<br>
<div class="im"><br>
> The below patch quickly fabricated here makes the window of opportunity<br>
> for the situation to arise sufficiently small (its not a proper fix!).<br>
<br>
</div>Interesting; while not a proper fix, as you said, your patch does help<br>
point at potential culprits. Thanks!<br></blockquote><div><br>Jamey was involved with this same problem a while ago. I provided patches but those weren't accepted, because the patches required such interface changes in libxcb that could have encouraged potentially dangerous use of the library.<br>
<br>The original patches can be found here: <a href="http://lists.freedesktop.org/archives/xcb/2010-October/006491.html">http://lists.freedesktop.org/archives/xcb/2010-October/006491.html</a>. Some discussion followed and the patches weren't accepted.<br>
<br>Jamey told that he's trying to think of a fix using poll() in libX11 that wouldn't require interface changes in libxcb. Before proceeding he asked me to supply a fixed version of one patch from the previous series. I did that in <a href="http://lists.freedesktop.org/archives/xcb/2010-October/006516.html">http://lists.freedesktop.org/archives/xcb/2010-October/006516.html</a> but it seems that the patch was forgotten, or Jamey has agreed with Josh not to apply it.<br>
<br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im"><br>
> Does anyone have a good idea of the causes of this problem and the<br>
> effects it has? I think some in-depth analysis would be in order to<br>
> solve the problem.<br></div></blockquote><div><br>It seems that libX11 has suffered from this since <a href="http://cgit.freedesktop.org/xorg/lib/libX11/commit/?id=933aee1d5c53b0cc7d608011a29188b594c8d70b">http://cgit.freedesktop.org/xorg/lib/libX11/commit/?id=933aee1d5c53b0cc7d608011a29188b594c8d70b</a>. All you have to do is wait for an event in one thread and wait for a reply in another one to trigger it. The reply waiter cannot continue until an event arrives. The _XReply and _XReadEvents functions of libX11 need to be fixed to solve this.<br>
<br>It's possible to fix this with interface changes in libxcb. It's probably possible to fix it without interface changes also, but that may be harder.<br> </div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">
<br>
</div>Just to confirm, can you provide the exact versions of XCB and of<br>
Xlib that you have? Xlib 1.4 had some potentially relevant fixes.<br></blockquote><div><br>I don't think that this has been fixed in libX11 yet.<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<font color="#888888"><br>
- Josh Triplett<br></font></blockquote></div><br>-- Rami<br><br>