Multiple Exceptions and SegFault When repeated calls to FinteGroup Module

25 views
Skip to first unread message

dus...@merrimack.edu

unread,
Jun 16, 2022, 11:40:17 AM6/16/22
to sage-support
I'm getting multiple exception errors resulting in a segfault when trying to control how long SageMath spends on structure_description() of a finite group. I'll attach a MWE and traceback, but basically what I'm doing is:

creating a Finite Group with ~10-20 generators and ~half that relations.

Setting an alarm...
running structure_description() with three possible outcomes of try...except:
* it works, tell me the result
* it fails, GAP knows why and I take over
* It fails because of the alarm timeout

Running this code in a loop eventually results in a segfault, probably with some conflict between the alarm and GAP exceptions, but the traceback suggests it's a problem in the free_group module...anyone have any thoughts?

[running code resulting in crash....]

Group Type is: --
20 [[9, 6, 2, 8], [8, 8], [10], [7, 2, 14, 4], [8], [14, 2, 6], [2, 10], [7, 9, 2], [10, 6, 8, 2], [13, 6, 11, 8], [3], [3]]
Finitely presented group < x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14 | x8*x5*x1*x7, x7^2, x9, x6*x1*x13*x3, x7, x13*x1*x5, x1*x9, x6*x8*x1, x9*x5*x7*x1, x12*x5*x10*x7, x2, x2 >
Some Unhandled exception!
Group Type is: --
21 [[5, 11, 6, 11], [1], [7, 11, 12], [14, 4], [7], [1], [10, 4], [14], [8, 11, 10, 1], [10, 10, 4], [10, 12], [12, 10, 14, 10]]
Traceback (most recent call last):
  File "/home/cduston/Downloads/SageMath/local/lib/python3.7/site-packages/sage/groups/free_group.py", line 881, in _element_constructor_
    P = x.parent()
AttributeError: 'list' object has no attribute 'parent'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "MWE.sage.py", line 39, in <module>
    G=H/[H(Y[i]) for i in range(g*V)]
  File "MWE.sage.py", line 39, in <listcomp>
    G=H/[H(Y[i]) for i in range(g*V)]
  File "sage/structure/parent.pyx", line 900, in sage.structure.parent.Parent.__call__ (build/cythonized/sage/structure/parent.c:9218)
  File "sage/structure/coerce_maps.pyx", line 156, in sage.structure.coerce_maps.DefaultConvertMap_unique._call_ (build/cythonized/sage/structure/coerce_maps.c:4448)
  File "/home/cduston/Downloads/SageMath/local/lib/python3.7/site-packages/sage/groups/free_group.py", line 883, in _element_constructor_
    return self.element_class(self, x, **kwds)
  File "/home/cduston/Downloads/SageMath/local/lib/python3.7/site-packages/sage/groups/free_group.py", line 230, in __init__
    AbstractWordTietzeWord = libgap.eval('AbstractWordTietzeWord')
  File "sage/libs/gap/libgap.pyx", line 400, in sage.libs.gap.libgap.Gap.eval (build/cythonized/sage/libs/gap/libgap.c:4205)
  File "sage/libs/gap/util.pyx", line 395, in sage.libs.gap.util.gap_eval (build/cythonized/sage/libs/gap/util.c:5990)
cysignals.signals.SignalError: Segmentation fault


MWE.sage

Duston, Christopher

unread,
Jul 7, 2022, 4:32:58 PM7/7/22
to sage-s...@googlegroups.com
I have found a little more information here that might be relevant (from Python forums, https://discuss.python.org/t/segfault-using-sage-function-with-try-except-alarminterrupt/16983/10), and I'm hoping this might drum up some interest before I blindly try to submit a bug report.

It's possible my vanilla Python code is not playing well with Sage - which is apparently written in Cython. If someone could let me know how to "cythonize" the follow code block, that would be helpful:

alarm(5)
    try:
        grpstr = str(G.structure_description())
    except ValueError:
        if G.simplified().relations() == ():
            grpstr = "F" + str(G.simplified().ngens())
        else:
            grpstr = "--"
            ExCases += 1
            pass
    except AlarmInterrupt:
        grpstr = "--"
        ExCases += 1
        pass
    except:
        print("Some Unhandled exception!")
        grpstr="I broke!"
        pass
    cancel_alarm()

--
You received this message because you are subscribed to a topic in the Google Groups "sage-support" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/sage-support/XdLzdI8Fmw0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to sage-support...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/36aed71a-552b-4e09-a3ab-172a50d90547n%40googlegroups.com.


--
Christopher L Duston
Associate Professor of Physics
Director of the Merrimack Observatory
Merrimack College
Palmisano 223
Reply all
Reply to author
Forward
0 new messages