Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random Segfaults in matrix_gap #37295

Open
2 tasks done
tobiasdiez opened this issue Feb 11, 2024 · 1 comment
Open
2 tasks done

Random Segfaults in matrix_gap #37295

tobiasdiez opened this issue Feb 11, 2024 · 1 comment
Labels

Comments

@tobiasdiez
Copy link
Contributor

tobiasdiez commented Feb 11, 2024

Steps To Reproduce

https://github.com/sagemath/sage/actions/runs/7730743552/job/21076818758
https://github.com/sagemath/sage/actions/runs/7666354980/job/20893984833

Expected Behavior

Tests pass

Actual Behavior

sage -t --random-seed=141136157000169917298631972457521844114 src/sage/matrix/matrix_gap.pyx
    Killed due to segmentation fault
**********************************************************************
Tests run before process (pid=101128) failed:
sage: M = MatrixSpace(ZZ, 2, implementation='gap') ## line 25 ##
sage: m1 = M([1, 0, 2, -3]) ## line 26 ##
sage: m2 = M([2, 2, 5, -1]) ## line 27 ##
sage: type(m1) ## line 28 ##
<class 'sage.matrix.matrix_gap.Matrix_gap'>
sage: m1 * m2 ## line 31 ##
[  2   2]
[-11   7]
sage: type(m1 * m2) ## line 34 ##
<class 'sage.matrix.matrix_gap.Matrix_gap'>
sage: M = MatrixSpace(QQ, 5, 3, implementation='gap') ## line 37 ##
sage: m = M(range(15)) ## line 38 ##
sage: m.left_kernel() ## line 39 ##
Vector space of degree 5 and dimension 3 over Rational Field
Basis matrix:
[ 1  0  0 -4  3]
[ 0  1  0 -3  2]
[ 0  0  1 -2  1]
sage: M = MatrixSpace(ZZ, 10, implementation='gap') ## line 46 ##
sage: m = M(range(100)) ## line 47 ##
sage: m.transpose().parent() is M ## line 48 ##
True
sage: UCF = UniversalCyclotomicField() ## line 52 ##
sage: M = MatrixSpace(UCF, 3, implementation='gap') ## line 53 ##
sage: m = M([UCF.zeta(i) for i in range(1,10)]) ## line 54 ##
sage: m ## line 55 ##
[               1               -1             E(3)]
[            E(4)             E(5)          -E(3)^2]
[            E(7)             E(8) -E(9)^4 - E(9)^7]
sage: (m^2)[1,2] ## line 59 ##
E(180)^32 - E(180)^33 + E(180)^68 - E(180)^69 + E(180)^104 - E(180)^141 - E(180)^156 + E(180)^176 - E(180)^177
sage: rings = [ZZ, QQ, UniversalCyclotomicField(), GF(2), GF(3)] ## line 64 ##
sage: rings += [UniversalCyclotomicField()]                                     # needs sage.rings.number_field ## line 65 ##
sage: for ring in rings:
    M = MatrixSpace(ring, 2, implementation='gap')
    TestSuite(M).run(skip=['_test_construction'])
    M = MatrixSpace(ring, 2, 3, implementation='gap')
    TestSuite(M).run(skip=['_test_construction']) ## line 66 ##
------------------------------------------------------------------------
/usr/share/miniconda3/envs/sage/lib/python3.11/site-packages/cysignals/signals.cpython-311-x86_64-linux-gnu.so(+0x795d)[0x7f2d8409c95d]
/usr/share/miniconda3/envs/sage/lib/python3.11/site-packages/cysignals/signals.cpython-311-x86_64-linux-gnu.so(+0x7a1b)[0x7f2d8409ca1b]
/usr/share/miniconda3/envs/sage/lib/python3.11/site-packages/cysignals/signals.cpython-311-x86_64-linux-gnu.so(+0x9fb7)[0x7f2d8409efb7]
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f2d85042520]
/usr/share/miniconda3/envs/sage/lib/libgap.so.8(CLEAN_OBJ+0x6)[0x7f2d2f6c1df6]
/usr/share/miniconda3/envs/sage/lib/libgap.so.8(+0xe516f)[0x7f2d2f6e516f]
/usr/share/miniconda3/envs/sage/lib/libgap.so.8(CopyObj+0x1c)[0x7f2d2f6c1eac]
/home/runner/work/sage/sage/src/sage/libs/gap/element.cpython-311-x86_64-linux-gnu.so(+0x29aa4)[0x7f2d3064daa4]
/home/runner/work/sage/sage/src/sage/matrix/matrix_gap.cpython-311-x86_64-linux-gnu.so(+0x9dd1)[0x7f2d79213dd1]
python3(_PyEval_EvalFrameDefault+0x370e)[0x55ff366ce89e]
python3(_PyFunction_Vectorcall+0x181)[0x55ff366eeeb1]
/home/runner/work/sage/sage/src/sage/misc/cachefunc.cpython-311-x86_64-linux-gnu.so(+0x2b5de)[0x7f2d841dd5de]
python3(_PyObject_MakeTpCall+0x253)[0x55ff366bddc3]
python3(_PyEval_EvalFrameDefault+0x716)[0x55ff366cb8a6]
python3(+0x2a49dd)[0x55ff367829dd]
python3(PyEval_EvalCode+0x9f)[0x55ff3678206f]
python3(+0x2bb62e)[0x55ff3679962e]
python3(_PyEval_EvalFrameDefault+0x370e)[0x55ff366ce89e]
python3(_PyFunction_Vectorcall+0x181)[0x55ff366eeeb1]
python3(_PyObject_FastCallDictTstate+0xe0)[0x55ff366c2910]
python3(_PyObject_Call_Prepend+0x69)[0x55ff366f68e9]
python3(+0x2e9728)[0x55ff367c7728]
python3(_PyObject_MakeTpCall+0x253)[0x55ff366bddc3]
python3(_PyEval_EvalFrameDefault+0x716)[0x55ff366cb8a6]
python3(_PyFunction_Vectorcall+0x181)[0x55ff366eeeb1]
python3(+0x21828c)[0x55ff366f628c]
python3(_PyObject_MakeTpCall+0x233)[0x55ff366bdda3]
python3(_PyEval_EvalFrameDefault+0x716)[0x55ff366cb8a6]
python3(+0x2a49dd)[0x55ff367829dd]
python3(PyEval_EvalCode+0x9f)[0x55ff3678206f]
python3(+0x2c2fca)[0x55ff367a0fca]
python3(+0x2beb43)[0x55ff3679cb43]
python3(+0x2d3f00)[0x55ff367b1f00]
python3(_PyRun_SimpleFileObject+0x1ae)[0x55ff367b189e]
python3(_PyRun_AnyFileObject+0x44)[0x55ff367b15c4]
python3(Py_RunMain+0x374)[0x55ff367abcb4]
python3(Py_BytesMain+0x37)[0x55ff36772067]
/lib/x86_64-linux-gnu/libc.so.6(+0x29d90)[0x7f2d85029d90]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x80)[0x7f2d85029e40]
python3(+0x293f0d)[0x55ff36771f0d]
------------------------------------------------------------------------
Attaching gdb to process id 101128.
Cannot find gdb installed
GDB is not installed.
Install gdb for enhanced tracebacks.
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred.
This probably occurred because a *compiled* module has a bug
in it and is not properly wrapped with sig_on(), sig_off().
Python will now terminate.
------------------------------------------------------------------------

Additional Information

No response

Environment

linux?

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide
@Mickanos
Copy link

Mickanos commented Feb 21, 2024

I have also recently encountered a random encounter using matrices, although nothing to do with gap as far as I can tell.
My bug is easy to reproduce:

sage: F.<x> = FunctionField(GF(3))
sage: x*mat(QQ,9,1,[1] + [0]*8)

This causes a segmentation fault. The funny part is that if you try a matrix with 8 lines instead, the coercion works properly.

I run version 10.3.beta8 on linux, but a friend has reproduced the bug on his machine with version 10.2.
I have also observed that sagecell seems does not answer after sending this code. However, I have a friend who still runs version 8.1 and for him the segfault does not happen.

It looks like your code also crashed when finite field are involved, so this might be the same problem.

vbraun pushed a commit to vbraun/sage that referenced this issue Dec 11, 2024
    
Just improve some documentation.

Apparently the existing documentation uses the absolute URL ``   * -
`Tutorial <../tutorial/index.html>`_`` e.g.
`sage/src/doc/en/developer/sage_manuals.rst`, none of them uses
`<tutorial>`. I tried using `<chapter-tutorial>` in https://github.com/s
agemath/sage/commit/955a09e746c7d9675d2a4c4f10558cec8d3eb948 but for
some reason it doesn't work, so I just end up deleting it.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion. (not aware of one)
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.

------

test failures have nothing to do with the change, see
sagemath#37295
    
URL: sagemath#38943
Reported by: user202729
Reviewer(s): Kwankyu Lee, user202729
vbraun pushed a commit to vbraun/sage that referenced this issue Dec 12, 2024
    
Just improve some documentation.

Apparently the existing documentation uses the absolute URL ``   * -
`Tutorial <../tutorial/index.html>`_`` e.g.
`sage/src/doc/en/developer/sage_manuals.rst`, none of them uses
`<tutorial>`. I tried using `<chapter-tutorial>` in https://github.com/s
agemath/sage/commit/955a09e746c7d9675d2a4c4f10558cec8d3eb948 but for
some reason it doesn't work, so I just end up deleting it.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion. (not aware of one)
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.

------

test failures have nothing to do with the change, see
sagemath#37295
    
URL: sagemath#38943
Reported by: user202729
Reviewer(s): Kwankyu Lee, user202729
vbraun pushed a commit to vbraun/sage that referenced this issue Dec 13, 2024
    
Just improve some documentation.

Apparently the existing documentation uses the absolute URL ``   * -
`Tutorial <../tutorial/index.html>`_`` e.g.
`sage/src/doc/en/developer/sage_manuals.rst`, none of them uses
`<tutorial>`. I tried using `<chapter-tutorial>` in https://github.com/s
agemath/sage/commit/955a09e746c7d9675d2a4c4f10558cec8d3eb948 but for
some reason it doesn't work, so I just end up deleting it.

### 📝 Checklist

<!-- Put an `x` in all the boxes that apply. -->

- [x] The title is concise and informative.
- [x] The description explains in detail what this PR is about.
- [x] I have linked a relevant issue or discussion. (not aware of one)
- [x] I have created tests covering the changes.
- [x] I have updated the documentation and checked the documentation
preview.

------

test failures have nothing to do with the change, see
sagemath#37295
    
URL: sagemath#38943
Reported by: user202729
Reviewer(s): Kwankyu Lee, user202729
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants