[IPython-dev] IPython threading bug (was: [Enthought-Dev] Bug concering X-Server)

Brian Granger ellisonbg at gmail.com
Wed Mar 24 13:14:13 EDT 2010


Gael,

[this email is not on enthoght-dev so can you forward]

On Sun, Mar 21, 2010 at 2:13 PM, Gael Varoquaux
<gael.varoquaux at normalesup.org> wrote:
> On Sun, Mar 21, 2010 at 10:07:02PM +0100, Martin Bothe wrote:
>>    Hello enthought-list-users,
>>    I tried a bit around and found a bug, so I report here.
>>    After creating a mayavi plot in ipython and attaching axes to it like so:
>>    ax = mlab.axes()
>>    I wrote in ipython: ax.axes. and hit the tab key which led to an error,
>>    making the terminal useless:
>>    In [32]: ax.axes.The program 'python' received an X Window System error.
>>    This probably reflects a bug in the program.
>>    The error was 'BadAccess (attempt to access private resource denied)'.
>>      (Details: serial 162967 error_code 10 request_code 153 minor_code 26)
>>      (Note to programmers: normally, X errors are reported asynchronously;
>>       that is, you will receive the error a while after causing it.
>>       To debug your program, run it with the --sync command line
>>       option to change this behavior. You can then get a meaningful
>>       backtrace from your debugger if you break on the gdk_x_error()
>>    function.)
>
> Hi Martin,
>
> Indeed, this is a bug from IPython: they are inspecting the object by
> calling some of its methods outside the GUI mainloop, in a separate
> thread. GUI toolkits cannot deal with such calls outside the main loop
> (they are not thread safe). As a result, you sometimes get crashes...

Yes, if this is the underlying problem, there is no way to solve the
problem other than moving to ipython dev trunk, which no longer uses
threads for GUI integration.

> The problem, I believe, is that the IPython codebase does not control
> when this call is made, but readline does, so it's a bit hard to inject
> it in the mainloop. That, said, I don't see why the readline callback
> couldn't inject the inspection code in the mainloop and busy wait for it
> to be called in the readline thread. Of course this is code to be
> written, and its probably tricky.

It is worse than tricky.  It is ugly and super thread-unsafe.  Like
playing tennis with a stick of dynamite.

> Anyhow, I am Ccing the IPython mailing list. I suspect that they are
> aware of the problem, and simply lack man-power to address it properly.

If I understand the issue correctly, we *have* solved it in dev trunk.
 But dev trunk currently has other issues with Mayavi/traits that may
bite you.  We know about these and have a plan to solve them.

Cheers,

Brian



-- 
Brian E. Granger, Ph.D.
Assistant Professor of Physics
Cal Poly State University, San Luis Obispo
bgranger at calpoly.edu
ellisonbg at gmail.com



More information about the IPython-dev mailing list