[Mesa-dev] [Xcb] [PATCH] fix deadlock with libX11

Uli Schlachter psychon at znc.in
Thu May 9 02:51:43 PDT 2013


Good morning everyone,

On 08.05.2013 23:30, Uli Schlachter wrote:
[...]
> Ah, after writing the rest of this mail, I just had this idea:
> 
> - X11 has taken the socket
> - Thread A has locked the display.
> - Thread B does xcb_no_operation() and thus ends up in libX11's return_socket(),
> waiting for the display lock.
> - Thread A calls e.g. xcb_no_operation(), too, ends up in return_socket() and
> because socket_moving == 1, ends up waiting for thread B
> 
> => Deadlock
> 
> Is this the issue you are seeing and which should be described better in the
> commit message? What are the actual functions involved in this? How mad would
> you be if I blamed libX11 for this? ;-)

Attached is a small test program to test this theory and this does indeed cause
a deadlock. However, I still wouldn't call this situation "classic", because
this involves waiting on a condition variable.

Is this the problem you are trying to fix?

It would be nice if the commit somehow referenced this so that, if this patch
ever causes any problems, we can test new patches against it.

[...]
>> Signed-off-by: Christian König <christian.koenig at amd.com>
[...]

I noticed that the patch is from a different mail address than your mail. Is
this intentional? Why?

Cheers,
Uli
-- 
Bruce Schneier can read and understand Perl programs.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t.c
Type: text/x-csrc
Size: 1746 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20130509/3219943e/attachment.c>


More information about the mesa-dev mailing list