Spinning in _XReply

Rami Ylimäki rami.ylimaki at vincit.fi
Tue Feb 22 02:30:06 PST 2011


On 02/22/2011 11:14 AM, Julien Cristau wrote:
> On Sat, Jan 29, 2011 at 09:54:37 -0800, Jeremy Huddleston wrote:
>
>> 2) emacs' error handler seems bugged.  Is it legal to call XSync() within the error handler?  It certainly seems like it shouldn't.  Did we used to actually support this with the xtrans version of libX11?
>>
> Not as far as I can tell.  From XSetErrorHandler(3):
>
>         Because this condition is not assumed to be fatal, it is acceptable for
>         your error handler to return; the returned value is ignored.  However,
>         the error handler should not call any functions (directly or indi‐
>         rectly) on the display that will generate protocol requests or that
>         will look for input events.
>
> That's not a new requirement.

I've been running Xlib with thread-safety checks 
(http://lists.x.org/archives/xorg-devel/2011-February/018979.html) and 
have found some problems even in single threaded clients. For example, 
one client was doing X requests from a signal handler, which is not 
allowed. Today I found out that even Mozilla code is suffering from this 
problem 
(http://mxr.mozilla.org/mozilla-central/source/toolkit/xre/nsX11ErrorHandler.cpp).

Adding Karl into CC. It looks like nsX11ErrorHandler.cpp is also calling 
Xlib functions resulting in protocol requests, which is not allowed.

-- Rami



More information about the xorg-devel mailing list