[Numpy-discussion] numpy core dump on linux

Charles R Harris charlesr.harris at gmail.com
Wed Sep 2 19:14:17 EDT 2009


On Wed, Sep 2, 2009 at 4:37 PM, Robert Kern <robert.kern at gmail.com> wrote:

> On Wed, Sep 2, 2009 at 17:23, Jeremy Mayes<jeremy.mayes at gmail.com> wrote:
> > This one line causes python to core dump on linux.
> > numpy.lexsort([
> >
> numpy.array(['-','-','-','-','-','-','-','-','-','-','-','-','-'])[::-1],numpy.array([732685.,
> > 732685.,  732685.,  732685.,  732685.,  732685.,732685.,  732685.,
> > 732685.,  732685.,  732685.,  732685.,  732679.])[::-1]])
> >
> > Here's some version info:
> >
> > python 2.5.4
> > numpy 1.3.0
> >
> > error is
> > *** glibc detected *** free(): invalid next size (fast):
> 0x0000000000526be0
> > ***
> >
> > Any ideas?
>
> Huh. The line executes for me on OS X, but the interpreter crashes
> when exiting. Here is my backtrace:
>
>
> Thread 0 Crashed:
> 0   org.python.python                   0x00270760 collect + 288
> 1   org.python.python                   0x002712ea PyGC_Collect + 42
> 2   org.python.python                   0x00260390 Py_Finalize + 208
> 3   org.python.python                   0x0026f750 Py_Main + 2768
> 4   org.python.python                   0x00001f82 0x1000 + 3970
> 5   org.python.python                   0x00001ea9 0x1000 + 3753
>
>
> Can you show us a gdb backtrace on your machine?
>
>
It's the [::-1] what done it. I suspect a copy is being made and has a bug.

In [1]: a = np.array(['-']*100)

In [2]: b = np.array([1.0]*100)

In [3]: i = lexsort((a,b))

In [4]: i = lexsort((a[::-1]))

In [5]: i = lexsort((b[::-1]))

In [6]: i = lexsort((a,b[::-1]))

In [7]: i = lexsort((a[::-1],b))

*Crash*

These also work:

In [3]: i = lexsort((b[::-1],a))

In [4]: i = lexsort((b[::-1],b[::-1]))

In [5]: i = lexsort((a[::-1],a[::-1]))

In [6]: i = lexsort((a,b[::-1]))

So it seems to be the combination of reversed string a with an array of
different type. Looks like a type setting is getting skipped somewhere.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090902/aa19df65/attachment.html>


More information about the NumPy-Discussion mailing list