IPython Segfaults (again)

Charles Moad wrote:

    >> I can't seem to crash TkAgg, but WXAgg and GTKAgg still do.
    >> This seems to not be related to the repr issue from before.
    >> This is all mpl-cvs btw.

    > OK, I'm afraid this one may require John's help to
    > debug. I don't know the mpl internals nearly well
    > enough to even begin to guess where this could be coming
    > from.

    > The fact that it's a segfault and not an uncaught
    > exception means the bug is triggered inside C code.
    > <TAB> triggers dir() and getattr() calls, which have to
    > traverse the object's internal dictionary. If the
    > object is implemented in C/C++, that traversal can do
    > arbitrary things, including any number of
    > segfault-inducing manipulations.

The canvas object (eg FigureCanvasGTKAgg) is implemented in python.
It inherits from a gtk base class and an Agg base class. It would be
useful to test whether you get this behavior on the GTK and WX
backends (no Agg). My guess is that this is some is caused by a
threading problem, but can't be sure. This would explain why you see
it with GTKAgg and WXAgg but not TkAgg.

JDH

It must be some kind of race condition. I can easily recreate the error on agg and non-agg wx and gtk backends (don't have qt). Here is what I do to cause the error fast.

plot(rand(100)) # just to have something up
f = get_current_fig_manager()
f.canvas<hold down tab>
# the key repeat will cause rapid fire on the completion

Straight Gtk periodically spits out something other than seg fault:
"In [6]:f.canvas.Fatal Python error: PyEval_SaveThread: NULL tstate"

Hope this helps,
  Charlie

John Hunter wrote:

···

"Fernando" == Fernando Perez <Fernando.Perez@...76...> writes:

    > Charles Moad wrote:
    >> I can't seem to crash TkAgg, but WXAgg and GTKAgg still do.
    >> This seems to not be related to the repr issue from before.
    >> This is all mpl-cvs btw.

    > OK, I'm afraid this one may require John's help to
    > debug. I don't know the mpl internals nearly well
    > enough to even begin to guess where this could be coming
    > from.

    > The fact that it's a segfault and not an uncaught
    > exception means the bug is triggered inside C code.
    > <TAB> triggers dir() and getattr() calls, which have to
    > traverse the object's internal dictionary. If the
    > object is implemented in C/C++, that traversal can do
    > arbitrary things, including any number of
    > segfault-inducing manipulations.

The canvas object (eg FigureCanvasGTKAgg) is implemented in python.
It inherits from a gtk base class and an Agg base class. It would be
useful to test whether you get this behavior on the GTK and WX
backends (no Agg). My guess is that this is some is caused by a
threading problem, but can't be sure. This would explain why you see
it with GTKAgg and WXAgg but not TkAgg.

JDH

Charles Moad wrote:

  It must be some kind of race condition. I can easily recreate the error on agg and non-agg wx and gtk backends (don't have qt). Here is what I do to cause the error fast.

plot(rand(100)) # just to have something up
f = get_current_fig_manager()
f.canvas<hold down tab>
# the key repeat will cause rapid fire on the completion

Straight Gtk periodically spits out something other than seg fault:
"In [6]:f.canvas.Fatal Python error: PyEval_SaveThread: NULL tstate"

Ah, then it _may_ be an old readline bug. An ipython user discovered it:

http://www.scipy.net/roundup/ipython/issue30

and then it went to python's SF tracker:

http://sourceforge.net/tracker/index.php?func=detail&aid=1166660&group_id=5470&atid=105470

You may have a python version still with the bug in it.

Cheers,

f