[IPython-dev] IPython threading bug (was: [Enthought-Dev] Bug concering X-Server)
Sun Mar 21 16:13:57 CDT 2010
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 : 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()
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...
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.
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.
More information about the IPython-dev