Opened 7 years ago

Closed 7 years ago

#13878 closed defect (fixed)

Fix failing assertion in linbox/matrix/permutation-matrix.h

Reported by: SimonKing Owned by: jason, was
Priority: major Milestone: sage-5.7
Component: linear algebra Keywords: debug, linbox, assertion
Cc: nbruin, vbraun, jpflori, malb Merged in: sage-5.7.beta4
Authors: Nils Bruin Reviewers: Simon King
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description (last modified by SimonKing)

With the Sage debug version of #13864, one gets the following crash, as reported by Nils:

sage: sage.homology.chain_complex.HomologyGroup(100)


ERROR (at getWritePointer in /home/simon/SAGE/debug/sage-5.6.beta1/local/include/linbox/matrix/permutation-matrix.h:175): 
Precondition not met:P_.size()
terminate called after throwing an instance of 'LinBox::PreconditionFailed'

Program received signal SIGABRT, Aborted.
0x00007ffff6d95d95 in raise () from /lib64/libc.so.6

APPLY

Attachments (2)

trac_13878-preliminary.patch (898 bytes) - added by nbruin 7 years ago.
preliminary fix
trac_13878-reviewer.patch (809 bytes) - added by SimonKing 7 years ago.

Download all attachments as: .zip

Change History (14)

comment:1 Changed 7 years ago by SimonKing

The gdb backtrace is as follows:

(gdb) bt
#0  0x00007ffff6d95d95 in raise () from /lib64/libc.so.6
#1  0x00007ffff6d972ab in abort () from /lib64/libc.so.6
#2  0x00007ffff2295f2d in __gnu_cxx::__verbose_terminate_handler() () from /usr/lib64/libstdc++.so.6
#3  0x00007ffff22940d6 in ?? () from /usr/lib64/libstdc++.so.6
#4  0x00007ffff2294103 in std::terminate() () from /usr/lib64/libstdc++.so.6
#5  0x00007ffff22941fe in __cxa_throw () from /usr/lib64/libstdc++.so.6
#6  0x00007fffd718c62f in LinBox::BlasPermutation<unsigned long>::getWritePointer (this=0x7fffffff6760) at /home/simon/SAGE/debug/sage-5.6.beta1/local/include/linbox/matrix/permutation-matrix.h:175
#7  0x00007fffd717f0b1 in LinBox::LQUPMatrix<LinBox::Modular<double> >::LQUPMatrix (this=0x7fffffff6700, A=..., P=..., Q=...)
    at /home/simon/SAGE/debug/sage-5.6.beta1/local/include/linbox/matrix/factorized-matrix.inl:810
#8  0x00007fffd716b350 in LinBox::EchelonFormDomain<LinBox::Modular<double> >::columnReducedEchelon<LinBox::BlasMatrix<LinBox::Modular<double> > > (this=0x6a247c0, E=...)
    at /home/simon/SAGE/debug/sage-5.6.beta1/local/include/linbox/algorithms/echelon-form.h:205
#9  0x00007fffd716653e in LinBox::EchelonFormDomain<LinBox::Modular<double> >::rowReducedEchelon<LinBox::BlasMatrix<LinBox::Modular<double> > > (this=0x6a247c0, E=..., A=...)
    at /home/simon/SAGE/debug/sage-5.6.beta1/local/include/linbox/algorithms/echelon-form.h:107
#10 0x00007fffd71279f5 in __pyx_f_4sage_6matrix_24matrix_modn_dense_double_linbox_echelonize_efd (__pyx_v_modulus=21059, __pyx_v_entries=0x6a24730, __pyx_v_nrows=0, __pyx_v_ncols=100)
    at sage/matrix/matrix_modn_dense_double.cpp:4074
#11 0x00007fffd71417ca in __pyx_pf_4sage_6matrix_24matrix_modn_dense_double_26Matrix_modn_dense_template_34_echelonize_linbox (__pyx_v_self=0x66aa6d8, __pyx_v_efd=0x7ffff7d89ec0 <_Py_TrueStruct>)
    at sage/matrix/matrix_modn_dense_double.cpp:11280
#12 0x00007fffd71411c1 in __pyx_pw_4sage_6matrix_24matrix_modn_dense_double_26Matrix_modn_dense_template_35_echelonize_linbox (__pyx_v_self=0x66aa6d8, __pyx_args=0x7ffff7f90060, __pyx_kwds=0x6a39940)
    at sage/matrix/matrix_modn_dense_double.cpp:11185
#13 0x00007ffff7a21088 in PyCFunction_Call (func=0x66b40d8, arg=0x7ffff7f90060, kw=0x6a39940) at Objects/methodobject.c:85
#14 0x00007ffff79be33e in PyObject_Call (func=0x66b40d8, arg=0x7ffff7f90060, kw=0x6a39940) at Objects/abstract.c:2529
#15 0x00007fffd713f3ce in __pyx_pf_4sage_6matrix_24matrix_modn_dense_double_26Matrix_modn_dense_template_32echelonize (__pyx_v_self=0x66aa6d8, __pyx_v_algorithm=0x26ae2e0, __pyx_v_kwds=0x6a37920)
    at sage/matrix/matrix_modn_dense_double.cpp:10889
#16 0x00007fffd713e64a in __pyx_pw_4sage_6matrix_24matrix_modn_dense_double_26Matrix_modn_dense_template_33echelonize (__pyx_v_self=0x66aa6d8, __pyx_args=0x7ffff7f90060, __pyx_kwds=0x6a368f0)
    at sage/matrix/matrix_modn_dense_double.cpp:10738
#17 0x00007ffff7a21088 in PyCFunction_Call (func=0x65abc90, arg=0x7ffff7f90060, kw=0x6a368f0) at Objects/methodobject.c:85
#18 0x00007ffff79be33e in PyObject_Call (func=0x65abc90, arg=0x7ffff7f90060, kw=0x6a368f0) at Objects/abstract.c:2529
#19 0x00007fffd9b50c55 in __pyx_pf_4sage_6matrix_7matrix2_6Matrix_134echelon_form (__pyx_v_self=0x66aa568, __pyx_v_algorithm=0x653be0, __pyx_v_cutoff=0x61f5b8, __pyx_v_kwds=0x67154d0)
    at sage/matrix/matrix2.c:31710
#20 0x00007fffd9b4ffca in __pyx_pw_4sage_6matrix_7matrix2_6Matrix_135echelon_form (__pyx_v_self=0x66aa568, __pyx_args=0x7ffff7f90060, __pyx_kwds=0x0) at sage/matrix/matrix2.c:31508
#21 0x00007ffff7a21088 in PyCFunction_Call (func=0xfb0588, arg=0x7ffff7f90060, kw=0x0) at Objects/methodobject.c:85
#22 0x00007ffff79be33e in PyObject_Call (func=0xfb0588, arg=0x7ffff7f90060, kw=0x0) at Objects/abstract.c:2529
#23 0x00007fffd95f2e94 in __pyx_pf_4sage_6matrix_7matrix0_6Matrix_124pivots (__pyx_v_self=0x66aa568) at sage/matrix/matrix0.c:20883
---Type <return> to continue, or q <return> to quit---
#24 0x00007fffd95f2af1 in __pyx_pw_4sage_6matrix_7matrix0_6Matrix_125pivots (__pyx_v_self=0x66aa568, unused=0x0) at sage/matrix/matrix0.c:20807
#25 0x00007ffff7ac675c in call_function (pp_stack=0x7fffffff72d0, oparg=0) at Python/ceval.c:4005
#26 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0x6817650, throwflag=0) at Python/ceval.c:2666
#27 0x00007ffff7ac708a in fast_function (func=0x66b1a38, pp_stack=0x7fffffff7650, n=1, na=1, nk=0) at Python/ceval.c:4107
#28 0x00007ffff7ac6d76 in call_function (pp_stack=0x7fffffff7650, oparg=1) at Python/ceval.c:4042
#29 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0x6804350, throwflag=0) at Python/ceval.c:2666
#30 0x00007ffff7ac40aa in PyEval_EvalCodeEx (co=0x6580eb0, globals=0x6715380, locals=0x0, args=0x68042c0, argcount=1, kws=0x68042c8, kwcount=2, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3253
#31 0x00007ffff7ac71b5 in fast_function (func=0x66b1cd8, pp_stack=0x7fffffff7b40, n=5, na=1, nk=2) at Python/ceval.c:4117
#32 0x00007ffff7ac6d76 in call_function (pp_stack=0x7fffffff7b40, oparg=513) at Python/ceval.c:4042
#33 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0x68040f0, throwflag=0) at Python/ceval.c:2666
#34 0x00007ffff7ac40aa in PyEval_EvalCodeEx (co=0x65807d0, globals=0x6715380, locals=0x0, args=0x81b948, argcount=1, kws=0x64fb770, kwcount=2, defs=0x66a96a0, defcount=2, closure=0x0)
    at Python/ceval.c:3253
#35 0x00007ffff79fd3fb in function_call (func=0x66b1e28, arg=0x81b920, kw=0x6716c20) at Objects/funcobject.c:526
#36 0x00007ffff79be33e in PyObject_Call (func=0x66b1e28, arg=0x81b920, kw=0x6716c20) at Objects/abstract.c:2529
#37 0x00007fffd7cd0cd1 in __pyx_pf_4sage_6matrix_20matrix_integer_dense_20Matrix_integer_dense_58echelon_form (__pyx_v_self=0x667ef60, __pyx_v_algorithm=0x25d53a0, 
    __pyx_v_proof=0x7ffff7d89ec0 <_Py_TrueStruct>, __pyx_v_include_zero_rows=0x7ffff7d89ec0 <_Py_TrueStruct>, __pyx_v_transformation=0x7ffff7d89e80 <_Py_ZeroStruct>, 
    __pyx_v_D=0x7ffff7d9db00 <_Py_NoneStruct>) at sage/matrix/matrix_integer_dense.c:15876
#38 0x00007fffd7ccdfeb in __pyx_pw_4sage_6matrix_20matrix_integer_dense_20Matrix_integer_dense_59echelon_form (__pyx_v_self=0x667ef60, __pyx_args=0x7ffff7f90060, __pyx_kwds=0x0)
    at sage/matrix/matrix_integer_dense.c:15247
#39 0x00007ffff7a21088 in PyCFunction_Call (func=0xfb0420, arg=0x7ffff7f90060, kw=0x0) at Objects/methodobject.c:85
#40 0x00007ffff7ac6b75 in call_function (pp_stack=0x7fffffff8310, oparg=0) at Python/ceval.c:4021
#41 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0x67e9f70, throwflag=0) at Python/ceval.c:2666
#42 0x00007ffff7ac708a in fast_function (func=0x2678060, pp_stack=0x7fffffff8690, n=3, na=3, nk=0) at Python/ceval.c:4107
#43 0x00007ffff7ac6d76 in call_function (pp_stack=0x7fffffff8690, oparg=2) at Python/ceval.c:4042
#44 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0x6714910, throwflag=0) at Python/ceval.c:2666
#45 0x00007ffff7ac40aa in PyEval_EvalCodeEx (co=0x2601880, globals=0x25c2ed0, locals=0x0, args=0x611ead8, argcount=2, kws=0x610f088, kwcount=3, defs=0x260c660, defcount=4, closure=0x0)
    at Python/ceval.c:3253
#46 0x00007ffff79fd3fb in function_call (func=0x2676d80, arg=0x611eab0, kw=0xff20c0) at Objects/funcobject.c:526
#47 0x00007ffff79be33e in PyObject_Call (func=0x2676d80, arg=0x611eab0, kw=0xff20c0) at Objects/abstract.c:2529
#48 0x00007ffff79da311 in instancemethod_call (func=0x2676d80, arg=0x611eab0, kw=0xff20c0) at Objects/classobject.c:2578
#49 0x00007ffff79be33e in PyObject_Call (func=0x6110460, arg=0x611eab0, kw=0xff20c0) at Objects/abstract.c:2529
#50 0x00007ffff7ac7a58 in do_call (func=0x6110460, pp_stack=0x7fffffff8ed0, na=2, nk=3) at Python/ceval.c:4239
#51 0x00007ffff7ac6d92 in call_function (pp_stack=0x7fffffff8ed0, oparg=770) at Python/ceval.c:4044
---Type <return> to continue, or q <return> to quit---
#52 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0x67146c0, throwflag=0) at Python/ceval.c:2666
#53 0x00007ffff7ac40aa in PyEval_EvalCodeEx (co=0x2604d50, globals=0x25c2ed0, locals=0x0, args=0x65ad788, argcount=3, kws=0xc16cc0, kwcount=2, defs=0x24b68f8, defcount=2, closure=0x0)
    at Python/ceval.c:3253
#54 0x00007ffff79fd3fb in function_call (func=0x2678ed0, arg=0x65ad760, kw=0xfef740) at Objects/funcobject.c:526
#55 0x00007ffff79be33e in PyObject_Call (func=0x2678ed0, arg=0x65ad760, kw=0xfef740) at Objects/abstract.c:2529
#56 0x00007ffff79da311 in instancemethod_call (func=0x2678ed0, arg=0x65ad760, kw=0xfef740) at Objects/classobject.c:2578
#57 0x00007ffff79be33e in PyObject_Call (func=0x61106e0, arg=0x611e7e0, kw=0xfef740) at Objects/abstract.c:2529
#58 0x00007ffff7a5f346 in slot_tp_init (self=0x6714550, args=0x611e7e0, kwds=0xfef740) at Objects/typeobject.c:5663
#59 0x00007ffff7a4c0dd in type_call (type=0x261c080, args=0x611e7e0, kwds=0xfef740) at Objects/typeobject.c:737
#60 0x00007ffff79be33e in PyObject_Call (func=0x261c080, arg=0x611e7e0, kw=0xfef740) at Objects/abstract.c:2529
#61 0x00007ffff7ac7a58 in do_call (func=0x261c080, pp_stack=0x7fffffff97d0, na=2, nk=2) at Python/ceval.c:4239
#62 0x00007ffff7ac6d92 in call_function (pp_stack=0x7fffffff97d0, oparg=514) at Python/ceval.c:4044
#63 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0x6713f10, throwflag=0) at Python/ceval.c:2666
#64 0x00007ffff7ac40aa in PyEval_EvalCodeEx (co=0x25f0930, globals=0x25c2ed0, locals=0x0, args=0xff7518, argcount=2, kws=0xff7528, kwcount=0, defs=0x2603c88, defcount=3, closure=0x0)
    at Python/ceval.c:3253
#65 0x00007ffff7ac71b5 in fast_function (func=0x2674648, pp_stack=0x7fffffff9cc0, n=2, na=2, nk=0) at Python/ceval.c:4117
#66 0x00007ffff7ac6d76 in call_function (pp_stack=0x7fffffff9cc0, oparg=1) at Python/ceval.c:4042
#67 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0xff7360, throwflag=0) at Python/ceval.c:2666
#68 0x00007ffff7ac40aa in PyEval_EvalCodeEx (co=0x5db5670, globals=0x561c7e0, locals=0x0, args=0xfa8f08, argcount=3, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3253
#69 0x00007ffff79fd3fb in function_call (func=0x5dbc5a0, arg=0xfa8ee0, kw=0x0) at Objects/funcobject.c:526
#70 0x00007ffff79be33e in PyObject_Call (func=0x5dbc5a0, arg=0xfa8ee0, kw=0x0) at Objects/abstract.c:2529
#71 0x00007ffff79da311 in instancemethod_call (func=0x5dbc5a0, arg=0xfa8ee0, kw=0x0) at Objects/classobject.c:2578
#72 0x00007ffff79be33e in PyObject_Call (func=0x6110560, arg=0x611e678, kw=0x0) at Objects/abstract.c:2529
#73 0x00007ffff7a5f346 in slot_tp_init (self=0xff69d0, args=0x611e678, kwds=0x0) at Objects/typeobject.c:5663
#74 0x00007ffff7a4c0dd in type_call (type=0x5dde2b0, args=0x611e678, kwds=0x0) at Objects/typeobject.c:737
#75 0x00007ffff79be33e in PyObject_Call (func=0x5dde2b0, arg=0x611e678, kw=0x0) at Objects/abstract.c:2529
#76 0x00007ffff7ac7a58 in do_call (func=0x5dde2b0, pp_stack=0x7fffffffa5c0, na=2, nk=0) at Python/ceval.c:4239
#77 0x00007ffff7ac6d92 in call_function (pp_stack=0x7fffffffa5c0, oparg=2) at Python/ceval.c:4044
#78 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0x6235f40, throwflag=0) at Python/ceval.c:2666
#79 0x00007ffff7ac40aa in PyEval_EvalCodeEx (co=0x5db5bf0, globals=0x561c7e0, locals=0x0, args=0x6235db0, argcount=1, kws=0x6235db8, kwcount=0, defs=0x5db9638, defcount=1, closure=0x0)
    at Python/ceval.c:3253
#80 0x00007ffff7ac71b5 in fast_function (func=0x5dadae0, pp_stack=0x7fffffffaab0, n=1, na=1, nk=0) at Python/ceval.c:4117
#81 0x00007ffff7ac6d76 in call_function (pp_stack=0x7fffffffaab0, oparg=1) at Python/ceval.c:4042
---Type <return> to continue, or q <return> to quit---
#82 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0x6235c20, throwflag=0) at Python/ceval.c:2666
#83 0x00007ffff7ac40aa in PyEval_EvalCodeEx (co=0x8a5d50, globals=0xfddea0, locals=0xfddea0, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3253
#84 0x00007ffff7ab9a88 in PyEval_EvalCode (co=0x8a5d50, globals=0xfddea0, locals=0xfddea0) at Python/ceval.c:667
#85 0x00007ffff7ac9693 in exec_statement (f=0x55054e0, prog=0x8a5d50, globals=0xfddea0, locals=0xfddea0) at Python/ceval.c:4718
#86 0x00007ffff7abde26 in PyEval_EvalFrameEx (f=0x55054e0, throwflag=0) at Python/ceval.c:1880
#87 0x00007ffff7ac40aa in PyEval_EvalCodeEx (co=0xecd720, globals=0xc4d510, locals=0x0, args=0x5504d80, argcount=2, kws=0x5504d90, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3253
#88 0x00007ffff7ac71b5 in fast_function (func=0xf96450, pp_stack=0x7fffffffb430, n=2, na=2, nk=0) at Python/ceval.c:4117
#89 0x00007ffff7ac6d76 in call_function (pp_stack=0x7fffffffb430, oparg=1) at Python/ceval.c:4042
#90 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0x5504bd0, throwflag=0) at Python/ceval.c:2666
#91 0x00007ffff7ac40aa in PyEval_EvalCodeEx (co=0xecd5c0, globals=0xc4d510, locals=0x0, args=0x614d2d8, argcount=3, kws=0x614d2f0, kwcount=0, defs=0xf8ff10, defcount=2, closure=0x0)
    at Python/ceval.c:3253
#92 0x00007ffff7ac71b5 in fast_function (func=0xf963a8, pp_stack=0x7fffffffb920, n=3, na=3, nk=0) at Python/ceval.c:4117
#93 0x00007ffff7ac6d76 in call_function (pp_stack=0x7fffffffb920, oparg=2) at Python/ceval.c:4042
#94 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0x614d130, throwflag=0) at Python/ceval.c:2666
#95 0x00007ffff7ac708a in fast_function (func=0xf964f8, pp_stack=0x7fffffffbca0, n=2, na=2, nk=0) at Python/ceval.c:4107
#96 0x00007ffff7ac6d76 in call_function (pp_stack=0x7fffffffbca0, oparg=1) at Python/ceval.c:4042
#97 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0xff4830, throwflag=0) at Python/ceval.c:2666
#98 0x00007ffff7ac40aa in PyEval_EvalCodeEx (co=0xecb9e0, globals=0xc4d510, locals=0x0, args=0xfee328, argcount=2, kws=0xfee338, kwcount=0, defs=0xf951d8, defcount=1, closure=0x0)
    at Python/ceval.c:3253
#99 0x00007ffff7ac71b5 in fast_function (func=0xf94e28, pp_stack=0x7fffffffc190, n=2, na=2, nk=0) at Python/ceval.c:4117
#100 0x00007ffff7ac6d76 in call_function (pp_stack=0x7fffffffc190, oparg=1) at Python/ceval.c:4042
#101 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0xfee190, throwflag=0) at Python/ceval.c:2666
#102 0x00007ffff7ac40aa in PyEval_EvalCodeEx (co=0xec7f60, globals=0xc4d510, locals=0x0, args=0xff9bb0, argcount=2, kws=0xff9bc0, kwcount=0, defs=0xf95168, defcount=1, closure=0x0)
    at Python/ceval.c:3253
#103 0x00007ffff7ac71b5 in fast_function (func=0xf94a38, pp_stack=0x7fffffffc680, n=2, na=2, nk=0) at Python/ceval.c:4117
#104 0x00007ffff7ac6d76 in call_function (pp_stack=0x7fffffffc680, oparg=1) at Python/ceval.c:4042
#105 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0xff9a10, throwflag=0) at Python/ceval.c:2666
#106 0x00007ffff7ac40aa in PyEval_EvalCodeEx (co=0x8db510, globals=0x8b46d0, locals=0x0, args=0x850278, argcount=1, kws=0x850280, kwcount=2, defs=0xddfb50, defcount=2, closure=0x0)
    at Python/ceval.c:3253
#107 0x00007ffff7ac71b5 in fast_function (func=0xfa2450, pp_stack=0x7fffffffcb70, n=5, na=1, nk=2) at Python/ceval.c:4117
#108 0x00007ffff7ac6d76 in call_function (pp_stack=0x7fffffffcb70, oparg=512) at Python/ceval.c:4042
#109 0x00007ffff7ac16ba in PyEval_EvalFrameEx (f=0x8500f0, throwflag=0) at Python/ceval.c:2666
#110 0x00007ffff7ac40aa in PyEval_EvalCodeEx (co=0x8001a0, globals=0x684820, locals=0x684820, args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:3253
---Type <return> to continue, or q <return> to quit---
#111 0x00007ffff7ab9a88 in PyEval_EvalCode (co=0x8001a0, globals=0x684820, locals=0x684820) at Python/ceval.c:667
#112 0x00007ffff7af836d in run_mod (mod=0x856078, filename=0x7fffffffd897 "/home/simon/SAGE/debug/sage-5.6.beta1/local/bin/sage-ipython", globals=0x684820, locals=0x684820, flags=0x7fffffffd0a0, 
    arena=0x76c9c0) at Python/pythonrun.c:1347
#113 0x00007ffff7af82f3 in PyRun_FileExFlags (fp=0x684a90, filename=0x7fffffffd897 "/home/simon/SAGE/debug/sage-5.6.beta1/local/bin/sage-ipython", start=257, globals=0x684820, locals=0x684820, 
    closeit=1, flags=0x7fffffffd0a0) at Python/pythonrun.c:1333
#114 0x00007ffff7af6aa0 in PyRun_SimpleFileExFlags (fp=0x684a90, filename=0x7fffffffd897 "/home/simon/SAGE/debug/sage-5.6.beta1/local/bin/sage-ipython", closeit=1, flags=0x7fffffffd0a0)
    at Python/pythonrun.c:937
#115 0x00007ffff7af6092 in PyRun_AnyFileExFlags (fp=0x684a90, filename=0x7fffffffd897 "/home/simon/SAGE/debug/sage-5.6.beta1/local/bin/sage-ipython", closeit=1, flags=0x7fffffffd0a0)
    at Python/pythonrun.c:741
#116 0x00007ffff7b12536 in Py_Main (argc=3, argv=0x7fffffffd228) at Modules/main.c:639
#117 0x00000000004007b4 in main (argc=3, argv=0x7fffffffd228) at ./Modules/python.c:23

Question: Is that an upstream bug or a bug in the Sage library?

comment:2 Changed 7 years ago by nbruin

It looks like trivial spans in large ZZ-modules are to blame:

invfac=[0]*75
n = len(invfac)
A = ZZ**n
B = A.span([A.gen(i) * invfac[i] for i in xrange(n)])

runs OK, but with invfac=[0]*76 we get the abort. With invfac=[1]+[0]*100 or invfac=[0]*100+[1] we don't get an error. Perhaps this helps to find the problematic code path?

comment:3 Changed 7 years ago by fbissey

I have commented on sage-devel, this is totally a DNDEBUG problem. We got slammed by it in sage-on-gentoo when linbox was updated since our python doesn't add DNDEBUG either. See https://github.com/cschwan/sage-on-gentoo/issues/166.

comment:4 Changed 7 years ago by nbruin

Offending code is this:

cdef inline linbox_echelonize_efd(celement modulus, celement* entries, Py_ssize_t nrows, Py_ssize_t ncols):
    cdef ModField *F = new ModField(<long>modulus)
    cdef EchelonFormDomain *EF = new EchelonFormDomain(F[0])
    cdef BlasMatrix *A = new BlasMatrix(F[0], <uint64_t>nrows, <uint64_t>ncols)
    cdef BlasMatrix *E = new BlasMatrix(F[0], <uint64_t>nrows, <uint64_t>ncols)

    cdef Py_ssize_t i,j

    # TODO: can we avoid this copy?
    for i in range(nrows):
        for j in range(ncols):
            A.setEntry(i, j, <ModFieldElement>entries[i*ncols+j])

    cdef int r = EF.rowReducedEchelon(E[0], A[0])
    for i in range(nrows):
        for j in range(ncols):
            entries[i*ncols+j] = <celement>E.getEntry(i,j)

    cdef Py_ssize_t ii = 0
    cdef list pivots = []
    for i in range(r):
        for j in range(ii,ncols):
            if entries[i*ncols+j] == 1:
                pivots.append(j)
                ii = j+1
                break

    del F, A, E, EF
    return r, pivots

This gets called with nrows=0, so A does not get initialized with anything (there's noting to set!). I suppose linbox should handle such an edge case, but I haven't checked their doc to see if they exclude it as valid. Obviously, it's easy to special case this degeneracy: If nrows=0 then we should return 0,[]. It's probably worthwhile to fix this, but I'm pretty sure this is not a source for bugs otherwise.

Changed 7 years ago by nbruin

preliminary fix

comment:5 Changed 7 years ago by nbruin

preliminary patch attached. It does make the annoying SIGABRTs go away, so it allows testing for other issues. I'm not particularly promoting this patch for general use (it'll be a bit of a speed penalty and I'm not so sure it's required for proper functioning under normal conditions)

comment:6 Changed 7 years ago by fbissey

I think it would be interesting to be able to use linbox without having to add DNDEBUG, it is a good thing in my book. Your fix seem minimal to me. Since sage-on-gentoo do not compile with DNDEBUG will I be able to open bugs each time I get a signal from linbox if we go that route :)

Last edited 7 years ago by fbissey (previous) (diff)

comment:7 follow-up: Changed 7 years ago by SimonKing

Hooray! With you preliminary patch and MALLOC_CHECK_=3, I get

sage: sage.homology.chain_complex.HomologyGroup(100)
Z^100

What is needed to do to finalise your preliminary patch? Adding the above example as a doc test would be half cheating, because this used only to fail in debug mode. But still, one could include this example and comment on it accordingly.

comment:8 in reply to: ↑ 7 Changed 7 years ago by nbruin

Replying to SimonKing:

What is needed to do to finalise your preliminary patch? Adding the above example as a doc test would be half cheating, because this used only to fail in debug mode. But still, one could include this example and comment on it accordingly.

At first blush it seems this is an upstream bug, so this would only be a workaround, not a proper fix. Furthermore, it seems this code seems to work in an NDEBUG linbox, so perhaps the test is just overzealous. I haven't checked linbox's documentation to see if they declare this input illegal.

Other than that, there already are doctests that test this issue, so a comment should be enough documentation for this fix.

Changed 7 years ago by SimonKing

comment:9 Changed 7 years ago by SimonKing

  • Authors set to Nils Bruin
  • Description modified (diff)
  • Status changed from new to needs_review

comment:10 Changed 7 years ago by SimonKing

  • Reviewers set to Simon King
  • Status changed from needs_review to positive_review

It might ultimately be an upstream bug. But I think fixing it on our end is fine. I suggest to get this in, so that Sage finally has a working debug version. Positive review. I documented the change in a comment, in my reviewer patch.

comment:11 Changed 7 years ago by SimonKing

  • Description modified (diff)

comment:12 Changed 7 years ago by jdemeyer

  • Merged in set to sage-5.7.beta4
  • Resolution set to fixed
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.