crash with 'todense' after scipy.io.mmread (Trac #343) #870

Closed
scipy-gitbot opened this Issue Apr 25, 2013 · 5 comments

1 participant

@scipy-gitbot

Original ticket http://projects.scipy.org/scipy/ticket/343 on 2007-01-11 by trac user jdpipe, assigned to @wnbell.

Hi there

I'm getting a big fat crash with 'todense' after I load in a matrix using scipy.io.mmread. The Matrix Market file I have createed myself -- there's not guarantee that it is correctly formed. But scipy shouldn't crash, right?

Will attach the offending matrix.

Cheers
JP

VERSION is 0.5.1 (ubuntu 6.10) not shown in list

john@roadwork:~$ ipython
Python 2.4.4c1 (#2, Oct 11 2006, 21:51:02)
Type "copyright", "credits" or "license" for more information.

IPython 0.7.2 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%magic -> Information about IPython's 'magic' % functions.
help -> Python's own help system.
object? -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import scipy, scipy.io

In [2]: scipy.io.mmread("/home/john/ascend/slv3mmio.mtx")
Out[2]:
<19x19 sparse matrix of type ''
with 49 stored elements in COOrdinate format>

In [3]: M = scipy.io.mmread("/home/john/ascend/slv3mmio.mtx")

In [4]: D = M.todense()
Segmentation fault (core dumped)
john@roadwork:~$

@scipy-gitbot

Attachment added by trac user jdpipe on 2007-01-11: slv3mmio.mtx

@scipy-gitbot

@nilswagner01 wrote on 2007-01-11

Here is a backtrace from gdb.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46912509653888 (LWP 25079)]
cootocsr<int, double> (n_row=19, n_col=19, NNZ=49, Ai=0x8dfa20, Aj=0x8d8570, Ax=0x9bde80, Bp=0x8df120, Bj=0x8df120, Bx=0x8df120)
    at sparsetools.h:524
524         tempBj[n] = Aj[i];
Current language:  auto; currently c++
(gdb) bt
#0  cootocsr<int, double> (n_row=19, n_col=19, NNZ=49, Ai=0x8dfa20, Aj=0x8d8570, Ax=0x9bde80, Bp=0x8df120, Bj=0x8df120, Bx=0x8df120)
    at sparsetools.h:524
#1  0x00002aaaafe5695c in _wrap_cootocsc__SWIG_4 (args=<value optimized out>) at sparsetools_wrap.cxx:8360
@scipy-gitbot

trac user jdpipe wrote on 2007-01-11

(gdb) where
#0  0xf8b00807 in ?? ()
#1  0x080b76df in PyEval_EvalFrame (f=0x86afa7c) at ../Python/ceval.c:1957
#2  0x080ba4b9 in PyEval_EvalCodeEx (co=0xb4cde320, globals=0xb4cc4cec, 
    locals=0x0, args=0x84ce6f8, argcount=2, kws=0x84ce700, kwcount=0, 
    defs=0xb5bf7fb8, defcount=2, closure=0x0) at ../Python/ceval.c:2741
#3  0x080b86ea in PyEval_EvalFrame (f=0x84ce544) at ../Python/ceval.c:3661
#4  0x080ba4b9 in PyEval_EvalCodeEx (co=0xb4ccc8a0, globals=0xb4cc4cec, 
    locals=0x0, args=0xb456e298, argcount=2, kws=0x87b9e30, kwcount=1, 
    defs=0xb4cdf330, defcount=4, closure=0x0) at ../Python/ceval.c:2741
#5  0x08102046 in function_call (func=0xb4cdcdbc, arg=0xb456e28c, 
    kw=0xb457002c) at ../Objects/funcobject.c:548
#6  0x08058c27 in PyObject_Call (func=0xf8b00807, arg=0xb456e28c, 
    kw=0xb457002c) at ../Objects/abstract.c:1795
#7  0x0805e4f4 in instancemethod_call (func=0xb4792f54, arg=0xb456e28c, 
    kw=0xb457002c) at ../Objects/classobject.c:2532
#8  0x08058c27 in PyObject_Call (func=0xf8b00807, arg=0xb45579ac, 
    kw=0xb457002c) at ../Objects/abstract.c:1795
#9  0x080b395c in PyEval_CallObjectWithKeywords (func=0xb4792f54, 
    arg=0xb45579ac, kw=0xb457002c) at ../Python/ceval.c:3435
#10 0x08061d41 in PyInstance_New (klass=0xb4cdb68c, arg=0xb45579ac, 
    kw=0xb457002c) at ../Objects/classobject.c:588
#11 0x08058c27 in PyObject_Call (func=0xf8b00807, arg=0xb45579ac, 
    kw=0xb457002c) at ../Objects/abstract.c:1795
---Type <return> to continue, or q <return> to quit---
#12 0x080b65c3 in PyEval_EvalFrame (f=0x83700bc) at ../Python/ceval.c:3776
#13 0x080b8d94 in PyEval_EvalFrame (f=0x878e1ec) at ../Python/ceval.c:3651
#14 0x080b8d94 in PyEval_EvalFrame (f=0x86f85fc) at ../Python/ceval.c:3651
#15 0x080b8d94 in PyEval_EvalFrame (f=0x864e804) at ../Python/ceval.c:3651
#16 0x080ba4b9 in PyEval_EvalCodeEx (co=0xb455dde0, globals=0xb7b7bd74, 
    locals=0xb7b7bd74, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, 
    defcount=0, closure=0x0) at ../Python/ceval.c:2741
#17 0x080b91e1 in PyEval_EvalFrame (f=0x8719f3c) at ../Python/ceval.c:484
#18 0x080ba4b9 in PyEval_EvalCodeEx (co=0xb7bb5660, globals=0xb7bac824, 
    locals=0x0, args=0xb4557a58, argcount=2, kws=0x0, kwcount=0, defs=0x0, 
    defcount=0, closure=0x0) at ../Python/ceval.c:2741
#19 0x08101f71 in function_call (func=0xb7afad14, arg=0xb4557a4c, kw=0x0)
    at ../Objects/funcobject.c:548
#20 0x08058c27 in PyObject_Call (func=0xf8b00807, arg=0xb4557a4c, kw=0x0)
    at ../Objects/abstract.c:1795
#21 0x0805e4f4 in instancemethod_call (func=0xb7b95a54, arg=0xb4557a4c, kw=0x0)
    at ../Objects/classobject.c:2532
#22 0x08058c27 in PyObject_Call (func=0xf8b00807, arg=0xb4557a4c, kw=0x0)
    at ../Objects/abstract.c:1795
#23 0x080b65c3 in PyEval_EvalFrame (f=0x81bd05c) at ../Python/ceval.c:3776
#24 0x080b8d94 in PyEval_EvalFrame (f=0x81a9c4c) at ../Python/ceval.c:3651
#25 0x080ba4b9 in PyEval_EvalCodeEx (co=0xb7b9e0e0, globals=0xb7c119bc, 
    locals=0x0, args=0xb7d7dd38, argcount=1, kws=0x0, kwcount=0, defs=0x0, 
---Type <return> to continue, or q <return> to quit---
    defcount=0, closure=0x0) at ../Python/ceval.c:2741
#26 0x08101f71 in function_call (func=0xb7afd8ec, arg=0xb7d7dd2c, kw=0x0)
    at ../Objects/funcobject.c:548
#27 0x08058c27 in PyObject_Call (func=0xf8b00807, arg=0xb7d7dd2c, kw=0x0)
    at ../Objects/abstract.c:1795
#28 0x0805e4f4 in instancemethod_call (func=0xb7903c34, arg=0xb7d7dd2c, kw=0x0)
    at ../Objects/classobject.c:2532
#29 0x08058c27 in PyObject_Call (func=0xf8b00807, arg=0xb7db502c, kw=0x0)
    at ../Objects/abstract.c:1795
#30 0x080b395c in PyEval_CallObjectWithKeywords (func=0xb7903c34, 
    arg=0xb7db502c, kw=0x0) at ../Python/ceval.c:3435
#31 0x080590d0 in PyObject_CallObject (o=0xb7903c34, a=0xb7db502c)
    at ../Objects/abstract.c:1786
gh-559 0xb7891b0a in init_gobject ()
   from /var/lib/python-support/python2.4/gtk-2.0/gobject/_gobject.so
gh-560 0xb77c8aa1 in g_source_is_destroyed () from /usr/lib/libglib-2.0.so.0
gh-561 0xb77ca802 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
gh-562 0xb77cd7df in g_main_context_check () from /usr/lib/libglib-2.0.so.0
gh-563 0xb77cdb89 in g_main_loop_run () from /usr/lib/libglib-2.0.so.0
gh-564 0xb73ad574 in gtk_main () from /usr/lib/libgtk-x11-2.0.so.0
gh-565 0xb76bbd90 in init_gtk ()
   from /var/lib/python-support/python2.4/gtk-2.0/gtk/_gtk.so
#39 0x080b8ab0 in PyEval_EvalFrame (f=0x818559c) at ../Python/ceval.c:3552
---Type <return> to continue, or q <return> to quit---
#40 0x080ba4b9 in PyEval_EvalCodeEx (co=0xb7b9e0a0, globals=0xb7c119bc, 
    locals=0x0, args=0x8155a88, argcount=1, kws=0x8155a8c, kwcount=0, 
    defs=0xb7ba8dd8, defcount=2, closure=0x0) at ../Python/ceval.c:2741
#41 0x080b86ea in PyEval_EvalFrame (f=0x815593c) at ../Python/ceval.c:3661
#42 0x080ba4b9 in PyEval_EvalCodeEx (co=0xb7deaca0, globals=0xb7dce824, 
    locals=0xb7dce824, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, 
    defcount=0, closure=0x0) at ../Python/ceval.c:2741
#43 0x080ba527 in PyEval_EvalCode (co=0xb7deaca0, globals=0xb7dce824, 
    locals=0xb7dce824) at ../Python/ceval.c:484
#44 0x080ddb1a in PyRun_FileExFlags (fp=0x8148008, 
    filename=0xbf9a7984 "/usr/bin/ipython", start=257, globals=0xb7dce824, 
    locals=0xb7dce824, closeit=1, flags=0xbf9a68f4)
    at ../Python/pythonrun.c:1285
#45 0x080ddd07 in PyRun_SimpleFileExFlags (fp=0x8148008, 
    filename=0xbf9a7984 "/usr/bin/ipython", closeit=1, flags=0xbf9a68f4)
    at ../Python/pythonrun.c:869
#46 0x08055cc2 in Py_Main (argc=2, argv=0xbf9a69c4) at ../Modules/main.c:493
#47 0x08055132 in main (argc=Cannot access memory at address 0xf8b00807
) at ../Modules/python.c:23
(gdb) 
@scipy-gitbot

@wnbell wrote on 2007-01-11

I think the row and column indices in you file are completely wrong:
http://projects.scipy.org/scipy/scipy/attachment/ticket/343/slv3mmio.mtx

I've added a check in coo_matrix() that throws an error for indices that lie outside the matrix dimensions.

@scipy-gitbot

Milestone changed to 0.5.3 Release by @jarrodmillman on 2007-01-16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment