bugGNU Octave - Bugs: bug #40364, segfault when comparing large...

 
 

bug #40364: segfault when comparing large sparse matrices for equality

Submitter:  David Spies <dspyz>
Submitted:  Thu 24 Oct 2013 06:40:55 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Segfault, Bus Error, etc.
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 04 Nov 2013 10:04:20 PM UTC, comment #8: 

About getting involved, this is a FAQ:

http://wiki.octave.org/FAQ#How_can_I_get_involved_in_Octave_development.3F

I just added a note about how running Octave in a debugger is a very good way to learn how it works.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Sat 02 Nov 2013 07:48:43 AM UTC, comment #7: 

I think the best way to get involved is to read the code, maybe try to fix a bug, join the maintainers mailing list and ask questions, or ask questions on the IRC channel.  There's no short cut and there's no formal guide.

John W. Eaton <jwe>
Group administrator
Fri 01 Nov 2013 04:29:15 PM UTC, comment #6: 

Thanks John,

Given an OOM with a stack trace, I can recognize that and change my code to say

assert(nnz(mutex != mutex') == 0);

David Spies <dspyz>
Fri 01 Nov 2013 04:24:52 PM UTC, comment #5: 

Thanks Rik,

I'd like to get involved in Octave development more, but I've never actually looked at the source code.  I just post bugs I happen to encounter while working on my project (Preprocessing SAT/ASP grounded problem instances to generate binary nogood clauses).

What's the best way to get started understanding the Octave code?

David Spies <dspyz>
Fri 01 Nov 2013 04:24:43 PM UTC, comment #4: 

I checked in the following change:

http://hg.savannah.gnu.org/hgweb/octave/rev/eaf5c3ef3e8d

With this change you'll get an out of memory error instead of a crash.  I think that's the best you can expect in this case since you are generating a matrix full of ones that is too large for 32-bit Octave to represent.

John W. Eaton <jwe>
Group administrator
Fri 01 Nov 2013 03:34:09 PM UTC, comment #3: 

Andreas has done a good job diagnosing where the problem code is.  I'm adding David to the e-mail list in the hopes that he has a quick idea about how to fix the constructor.

Rik <rik5>
Group administrator
Thu 31 Oct 2013 07:59:52 PM UTC, comment #2: 

I want to clarify that my backtrace was the result from David Spies's test case. In his code there is an

assert(mutex == mutex');


The same segfault can be reproduced with

a=sparse([1, 4.7e4], [1, 4.7e4],[ 1 1]);
x = a == a;


This is because in the constructor in Sparse.h:88

SparseRep (octave_idx_type nr, octave_idx_type nc, octave_idx_type nz = 0)

nz overflows for int32 when called in

Sparse.cc:208: rep = new typename Sparse<T>::SparseRep (nr, nc, nr*nc);


Andreas Weber <andy1978>
Group Member
Thu 31 Oct 2013 06:40:38 PM UTC, comment #1: 

A short example which triggers this bug is

a=sparse([1, 8e5], [1, 8e5],[ 1 1]);
a==a


bt

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffe0f0b700 (LWP 20300)]
0x00007ffff5a7e8f3 in Sparse<bool>::Sparse (this=0x7fffe0f094a0, nr=80274, nc=80274, val=true)
    at ../../octave-src/liboctave/array/Sparse.cc:216
216                      xdata (ii) = val;
#0  0x00007ffff5a7e8f3 in Sparse<bool>::Sparse (this=0x7fffe0f094a0, nr=80274, nc=80274, val=true)
    at ../../octave-src/liboctave/array/Sparse.cc:216
#1  0x00007ffff69bfa2f in SparseBoolMatrix::SparseBoolMatrix (this=0x7fffe0f094a0, r=80274, c=80274,
    val=true) at ../../octave-src/liboctave/array/boolSparse.h:45
#2  0x00007ffff58b6e4e in mx_el_eq (m1=..., m2=...)
    at ../../octave-src/liboctave/array/boolSparse.cc:324
#3  0x00007ffff6bb83d6 in oct_binop_eq (a1=..., a2=...)


Andreas Weber <andy1978>
Group Member
Thu 24 Oct 2013 06:40:55 PM UTC, original submission:  

I've attached the functions I use and the data that causes the segfault.  Run totalClosure(constraints,mutex)

David Spies <dspyz>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #29464:  andnot.m added by dspyz (233B - text/x-objcsrc - Sorry, I forgot this one)
file #29463:  crash.tar.gz added by dspyz (2MiB - application/x-gzip)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by jordigh (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by rik5
  • -email is unavailable- added by andy1978 (Posted a comment)
  • -email is unavailable- added by dspyz (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-11-02 jwe StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2013-11-01 rik5 Carbon-Copy- Added dbateman
    2013-10-31 andy1978 StatusNone Confirmed
        SummaryOctave consistently segfaults when this method is run on the attached data segfault when comparing large sparse matrices for equality
    2013-10-24 dspyz Attached File- Added andnot.m, #29464
    2013-10-24 dspyz Attached File- Added crash.tar.gz, #29463

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code