Re: weird bug -- any ideas

View: New views
2 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: weird bug -- any ideas

by Fernando Perez-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Fri, Nov 13, 2009 at 2:36 PM, William Stein <wstein@...> wrote:

> If any Ipython devs have Sage installed perhaps you could try looking at
>
>   http://trac.sagemath.org/sage_trac/ticket/7449
>
> and see if anything pops into your head.  It's a weird bug in
> introspection where it uses *all* RAM on whatever computer it's run
> on.  The strange thing is that exactly the same thing in the Sage
> notebook works fine (which doesn't use Ipython, but uses similar code
> to implement something similar).
>
> Anyway, any hints are appreciated.   I don't read ipython-dev, so
> maybe this message will bounce -- anyway, respond to me directly if
> you have any thoughts.

Very weird... The funny thing is, the introspection actually finished
very fast: if you do

Ctrl-C

you get the information fine (I just tried).  So something *at the
end* of the introspection is hanging, and it slowly but surely uses up
all RAM.

One thing I can tell you is that upgrading to 0.10 won't help, I just
tried updating the sage ipython to 0.10 and the problem is still
there.

I'll try to have a look and see if I can understand where this is coming from.

The fact that Ctrl-C cleanly stops the crazy loop *without* a
KeyboardInterrupt makes me think that ipython is trying to introspect
the MS object and some C code is going into a mad loop (otherwise we'd
see the Python signal handler showing a traceback).  Do you have any
other bugs related to this type of object that sound along those
lines?

We'll keep looking...

f
_______________________________________________
IPython-dev mailing list
IPython-dev@...
http://mail.scipy.org/mailman/listinfo/ipython-dev

Re: weird bug -- any ideas

by Fernando Perez-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, Nov 16, 2009 at 2:31 AM, Fernando Perez
<Fernando.Perez@...> wrote:
> The fact that Ctrl-C cleanly stops the crazy loop *without* a
> KeyboardInterrupt makes me think that ipython is trying to introspect
> the MS object and some C code is going into a mad loop (otherwise we'd
> see the Python signal handler showing a traceback).  Do you have any
> other bugs related to this type of object that sound along those
> lines?

Half-right. IPython is swallowing the kbd interrupt, but the bug is in
sage, it's the fact that len(MS) never returns:

sage: MS = MatrixSpace(QQ,6,6,sparse=True); MS
Full MatrixSpace of 6 by 6 sparse matrices over Rational Field
sage: len(MS)
^C---------------------------------------------------------------------------
KeyboardInterrupt                         Traceback (most recent call last)

/home/fperez/ipython/repo/kernel-config-lp/docs/<ipython console> in <module>()

/opt/sage/local/lib/python2.6/site-packages/sage/structure/parent.so
in sage.structure.parent.Parent.__len__
(sage/structure/parent.c:5533)()

/opt/sage/local/lib/python2.6/site-packages/sage/structure/parent.so
in sage.structure.parent.Parent.list (sage/structure/parent.c:4995)()

/opt/sage/local/lib/python2.6/site-packages/sage/matrix/matrix_space.pyc
in __iter__(self)
    751             while True:
    752                 for iv in
sage.combinat.integer_vector.IntegerVectors(weight,
number_of_entries):
--> 753                     yield self(entries=[base_elements[i] for i
in iv], rows=True)
    754
    755                 weight += 1

/opt/sage/local/lib/python2.6/site-packages/sage/matrix/matrix_space.pyc
in __call__(self, entries, coerce, copy, rows)
    371             copy = False
    372         elif self.__is_sparse and isinstance(entries, (list, tuple)):
--> 373             entries = list_to_dict(entries, self.__nrows,
self.__ncols, rows=rows)
    374             coerce = True
    375             copy = False

/opt/sage/local/lib/python2.6/site-packages/sage/matrix/matrix_space.pyc
in list_to_dict(entries, nrows, ncols, rows)
   1240                 d[(row,col)] = x
   1241             else:
-> 1242                 d[(col,row)] = x
   1243     return d
   1244

/opt/sage/local/lib/python2.6/site-packages/sage/interfaces/get_sigs.pyc
in my_sigint(x, n)
      7
      8 def my_sigint(x, n):
----> 9     raise KeyboardInterrupt
     10
     11 def my_sigfpe(x, n):

KeyboardInterrupt:


It seems that the ms object implements __len__, but this function
never returns.  It's just that ipython was calling len() on it.

Cheers,

f
_______________________________________________
IPython-dev mailing list
IPython-dev@...
http://mail.scipy.org/mailman/listinfo/ipython-dev