-
-
Notifications
You must be signed in to change notification settings - Fork 482
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
Segfault testing src/sage/libs/gap/element.pyx on python 3.12 #37026
Comments
my eyes bleed from this line: rnd = [ randint(-10,10) for i in range(randint(0,7)) ] How about rnd = random.choices(range(-10,10), k=randint(0,7)) ? See https://docs.python.org/3/library/random.html#random.choices |
maybe it segfaults on |
This also pops up on Fedora 39 with system Python 3.12, see e.g. https://groups.google.com/g/sage-release/c/oTnTrEnB3YU/m/tZiLm66ZAwAJ |
But I can't reproduce this with Python 3.12.2 |
Is it possible that both @jaapspies and me are missing some python3 system package? |
At some point this segfault occured only in tests, now it happens also in the command line |
Tried that but it does not have an effect
|
There's a more detailed trace in #36407 (comment) |
Caused by GCC commit https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=049ec9b981d1f4f97736061d5cf7d0ae990b57d7 Upstream report: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114872 Can be reproduced by calling any libgap function in exactly 3 parameters, eg. |
@sheerluck has kindly disassembled broken Fixing gcc is above my payrate, though :-) |
This appears to fix sagemath#37026
more discussion on https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114872 seems to indicate that gcc is actually not broken, it's our code that is (missing volatile declarations). If I am not mistaken, we have
and the Looks like a lot of |
See https://trofi.github.io/posts/312-the-sagemath-saga.html for a detailed analysis. Not sure whether the detail that GAP uses setjmp/longjmp to return from |
By the way, the Python 3.12 is only needed to produce a crash. Otherwise, we get a memory leak, as these temporary GAP objects are not cleared.
|
This appears to fix sagemath#37026 (segfaults in src/sage/libs/gap/element.pyx with Python 3.12 and gcc 13.2.1) See also sagemath#36407 (comment) The corresponding gcc 13.2.1's bug (or feature) is being dealt with here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114872 ### 📝 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. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#37951 Reported by: Dima Pasechnik Reviewer(s): Dima Pasechnik, Gonzalo Tornaría
This appears to fix sagemath#37026 (segfaults in src/sage/libs/gap/element.pyx with Python 3.12 and gcc 13.2.1) See also sagemath#36407 (comment) The corresponding gcc 13.2.1's bug (or feature) is being dealt with here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114872 ### 📝 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. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#37951 Reported by: Dima Pasechnik Reviewer(s): Dima Pasechnik, Gonzalo Tornaría
This appears to fix sagemath#37026 (segfaults in src/sage/libs/gap/element.pyx with Python 3.12 and gcc 13.2.1) See also sagemath#36407 (comment) The corresponding gcc 13.2.1's bug (or feature) is being dealt with here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114872 ### 📝 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. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#37951 Reported by: Dima Pasechnik Reviewer(s): Dima Pasechnik, Gonzalo Tornaría
This appears to fix sagemath#37026 (segfaults in src/sage/libs/gap/element.pyx with Python 3.12 and gcc 13.2.1) See also sagemath#36407 (comment) The corresponding gcc 13.2.1's bug (or feature) is being dealt with here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114872 ### 📝 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. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> URL: sagemath#37951 Reported by: Dima Pasechnik Reviewer(s): Dima Pasechnik, Gonzalo Tornaría
I'm afraid this is still happening in 10.4.beta7, which is supposed to include 72e6b66 |
we should do rigorous fixing, not just an ad hoc We need a stateless way to create GAP objects, |
…port of Python 3.12.x stable <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> https://docs.python.org/3/whatsnew/changelog.html#python-3-12-4-final - In part cherry-picked from sagemath#36181 ### 📝 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. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> - Depends on sagemath#37914 (merged here) - Depends on sagemath#37951 (merged here for sagemath#37026) - Depends on sagemath#38144 (merged here for testing) URL: sagemath#37834 Reported by: Matthias Köppe Reviewer(s):
…port of Python 3.12.x stable <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> https://docs.python.org/3/whatsnew/changelog.html#python-3-12-4-final - In part cherry-picked from sagemath#36181 ### 📝 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. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> - Depends on sagemath#37914 (merged here) - Depends on sagemath#37951 (merged here for sagemath#37026) - Depends on sagemath#38144 (merged here for testing) URL: sagemath#37834 Reported by: Matthias Köppe Reviewer(s):
…port of Python 3.12.x stable <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> https://docs.python.org/3/whatsnew/changelog.html#python-3-12-4-final - In part cherry-picked from sagemath#36181 ### 📝 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. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> - Depends on sagemath#37914 (merged here) - Depends on sagemath#37951 (merged here for sagemath#37026) - Depends on sagemath#38144 (merged here for testing) URL: sagemath#37834 Reported by: Matthias Köppe Reviewer(s):
…port of Python 3.12.x stable <!-- ^ Please provide a concise and informative title. --> <!-- ^ Don't put issue numbers in the title, do this in the PR description below. --> <!-- ^ For example, instead of "Fixes sagemath#12345" use "Introduce new method to calculate 1 + 2". --> <!-- v Describe your changes below in detail. --> <!-- v Why is this change required? What problem does it solve? --> <!-- v If this PR resolves an open issue, please link to it here. For example, "Fixes sagemath#12345". --> https://docs.python.org/3/whatsnew/changelog.html#python-3-12-4-final - In part cherry-picked from sagemath#36181 ### 📝 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. - [ ] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. ### ⌛ Dependencies <!-- List all open PRs that this PR logically depends on. For example, --> <!-- - sagemath#12345: short description why this is a dependency --> <!-- - sagemath#34567: ... --> - Depends on sagemath#37914 (merged here) - Depends on sagemath#37951 (merged here for sagemath#37026) - Depends on sagemath#38144 (merged here for testing) URL: sagemath#37834 Reported by: Matthias Köppe Reviewer(s):
I'm also seeing this problem on NixOS CI. With the patch in #37951 applied, the temporary variable used to hold diff --git a/src/sage/libs/gap/element.pyx b/src/sage/libs/gap/element.pyx
index b2b0681c052..b2e5807392c 100644
--- a/src/sage/libs/gap/element.pyx
+++ b/src/sage/libs/gap/element.pyx
@@ -35,6 +35,13 @@ from sage.structure.coerce cimport coercion_model as cm
### helper functions to construct lists and records ########################
############################################################################
+
+cdef extern from *:
+ """
+ #pragma GCC optimize("O1")
+ """
+
+
cdef Obj make_gap_list(sage_list) except NULL:
"""
Convert Sage lists into Gap lists
|
This is back:
|
I am getting this:
The same output in Sage 10.4 |
Perhaps more
Compilers get more efficient in optimising register allocation, killing our stateful interfaces with GAP and probably more... |
I'm sure it is still system-dependent since it was originally "triggered" by a minor GCC update, but I've got it on two very different machines with both gcc-13 and gcc-14 now. I did try adding more |
What GAP versions do you test with? |
Usually with 4.13.1 from Gentoo, but this is happening with the 4.12.2 SPKG as well. |
OK, so I have those two machines one is "sage-on-gentoo" release (currently 10.4) and the other is "sage-on-gentoo" cutting edge (Volker's merging branch). |
Of interest to me is the explicit coercion of |
I see @enriqueartal 's output with 10.5.beta6 and Sage's GAP. I get a coredump in Linux x86_64 conda-installed, with Python 3.12, Sage 10.4. |
Testing #38804 with the new gap-4.13.1 SPKG:
|
...which of course comes right after
|
Concerning the error in
src/sage/libs/gap/element.pyx
, it happens in line 2489:getting
Killed due to segmentation fault
. Running this code in the terminal works, the error appears only in tests and with python 3.12.Originally posted by @enriqueartal in #37011 (comment)
The text was updated successfully, but these errors were encountered: