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

RSK on symmetric group element kills the kernel #37437

Open
2 tasks done
yeetkode opened this issue Feb 23, 2024 · 2 comments
Open
2 tasks done

RSK on symmetric group element kills the kernel #37437

yeetkode opened this issue Feb 23, 2024 · 2 comments

Comments

@yeetkode
Copy link

yeetkode commented Feb 23, 2024

Steps To Reproduce

  1. Create an element of SymmetricGroup(n), say P.
  2. Call the function RSK(P).

Expected Behavior

ValueError: P is not one of the types supported by RSK, or some similar way of declaring an error.

Actual Behavior

The kernel dies.

Additional Information

No response

Environment

- **OS**: MacOS 14 Sonoma
- **Hardware**: M2 Silicon Chip MacBook Air 13'
- **Sage Version**: 10.0

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
@mezzarobba
Copy link
Member

Confirmed:

sage: RSK(SymmetricGroup(2).an_element())
[...]
#8  0x00007f1d9a95fd1d in __Pyx_PyObject_GetAttrStr (
    attr_name=<optimized out>, obj=<unknown at remote 0x7f1d947de700>)
    at sage/groups/perm_gps/permgroup_element.c:31049
        tp = <optimized out>
        tp = <optimized out>
#9  __pyx_pf_4sage_6groups_8perm_gps_17permgroup_element_23PermutationGroupElement_42__mul__ (
    __pyx_v_right=<sage.groups.perm_gps.permgroup_element.SymmetricGroupElement at remote 0x7f1d91717d00>, __pyx_v_left=[<unknown at remote 0xa4c3e9>])
    at sage/groups/perm_gps/permgroup_element.c:20169
        __pyx_t_2 = <optimized out>
        __pyx_t_7 = <optimized out>
        __pyx_lineno = 0
        __pyx_filename = 0x0
        __pyx_v_pl = 0x7f1d90c51c00
        __pyx_v_prod = 0x0
        __pyx_t_3 = 0x0
        __pyx_t_8 = <optimized out>
        __pyx_L1_error = <optimized out>
        __pyx_v_pr = 0x7f1d91717d00
        __pyx_v_Pleft = 0x7f1d947de700
        __pyx_t_4 = 0x0
        __pyx_v_i = <optimized out>
        __pyx_r = 0x0
        __pyx_t_5 = 0x0
        __pyx_clineno = 0
        __pyx_v_Pright = 0x7f1d94982990
        __pyx_t_1 = <optimized out>
        __pyx_t_6 = <optimized out>
        __pyx_v_pl = <optimized out>
        __pyx_v_pr = <optimized out>
        __pyx_v_prod = <optimized out>
        __pyx_v_i = <optimized out>
        __pyx_v_Pleft = <optimized out>
        __pyx_v_Pright = <optimized out>
        __pyx_r = <optimized out>
        __pyx_t_1 = <optimized out>
        __pyx_t_2 = <optimized out>
        __pyx_t_3 = <optimized out>
        __pyx_t_4 = <optimized out>
        __pyx_t_5 = <optimized out>
        __pyx_t_6 = <optimized out>
        __pyx_t_7 = <optimized out>
        __pyx_t_8 = <optimized out>
        __pyx_lineno = <optimized out>
        __pyx_filename = <optimized out>
        __pyx_clineno = <optimized out>
        __pyx_L4_bool_binop_done = <optimized out>
        __pyx_L1_error = <optimized out>
        __pyx_L0 = <optimized out>
        __pyx_L6 = <optimized out>
        __pyx_dict_version = 0
        __pyx_dict_cached_value = 0x0
#10 __pyx_pw_4sage_6groups_8perm_gps_17permgroup_element_23PermutationGroupElement_43__mul__ (__pyx_v_left=__pyx_v_left@entry=[<unknown at remote 0xa4c3e9>],
    __pyx_v_right=__pyx_v_right@entry=<sage.groups.perm_gps.permgroup_element.SymmetricGroupElement at remote 0x7f1d91717d00>)
    at sage/groups/perm_gps/permgroup_element.c:19858
        __pyx_kwvalues = 0x0
        __pyx_r = 0x0
#11 0x00000000005997ac in binary_op1 (op_slot=16,
    w=<sage.groups.perm_gps.permgroup_element.SymmetricGroupElement at remote 0x7f1d91717d00>, v=[<unknown at remote 0xa4c3e9>]) at ../Objects/abstract.c:901
        x = <optimized out>
        slotv = <optimized out>
        slotw = 0x7f1d9a95fa10 <__pyx_pw_4sage_6groups_8perm_gps_17permgroup_element_23PermutationGroupElement_43__mul__>
        slotv = <optimized out>
        slotw = <optimized out>
        x = <optimized out>
        x = <optimized out>
#12 PyNumber_Multiply (v=[<unknown at remote 0xa4c3e9>],
    w=<sage.groups.perm_gps.permgroup_element.SymmetricGroupElement at remote 0x7f1d91717d00>) at ../Objects/abstract.c:1111
        result = <optimized out>
        mv = <optimized out>
        mw = <optimized out>
[...]
Cython backtrace
----------------
#0  0x00007f1ded1351e0 in __GI___wait4 () at ./posix/../sysdeps/unix/sysv/linux/wait4.c:30
#1  0x00007f1ded1351b0 in __GI___waitpid () at ./posix/./posix/waitpid.c:38
#2  0x00007f1decb7fada in print_enhanced_backtrace () at /home/marc/co/sage/local/var/lib/sage/venv-python3.11/var/tmp/sage/build/cysignals-1.11.4/src/build/src/cysignals/implementation.c:672
#3  0x00007f1decb7fa50 in sigdie () at /home/marc/co/sage/local/var/lib/sage/venv-python3.11/var/tmp/sage/build/cysignals-1.11.4/src/build/src/cysignals/implementation.c:698
#4  0x00007f1decb82900 in sigdie_for_sig () at /home/marc/co/sage/local/var/lib/sage/venv-python3.11/var/tmp/sage/build/cysignals-1.11.4/src/build/src/cysignals/implementation.c:256
#5  0x00007f1decb828e0 in cysigs_signal_handler () at /home/marc/co/sage/local/var/lib/sage/venv-python3.11/var/tmp/sage/build/cysignals-1.11.4/src/build/src/cysignals/implementation.c:361
#6  0x00007f1ded3c47f0 in __restore_rt ()
#7  0x0000000000000000 in ?? ()
#8  0x00007f1d9a95fcf7 in __Pyx_PyObject_GetAttrStr () at /home/marc/co/sage/src/sage/groups/perm_gps/permgroup_element.c:31049
  31044    /* PyObjectGetAttrStr */
  31045    #if CYTHON_USE_TYPE_SLOTS
  31046    static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
  31047        PyTypeObject* tp = Py_TYPE(obj);
  31048        if (likely(tp->tp_getattro))
> 31049            return tp->tp_getattro(obj, attr_name);
  31050    #if PY_MAJOR_VERSION < 3
  31051        if (likely(tp->tp_getattr))
  31052            return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
  31053    #endif
#9  0x00007f1d9a95fa28 in __pyx_pf_4sage_6groups_8perm_gps_17permgroup_element_23PermutationGroupElement_42__mul__ () at /home/marc/co/sage/src/sage/groups/perm_gps/permgroup_element.c:20169
  20164     *             Pright = pr._parent
  20165     *             if Pleft._domain == Pright._domain:             # <<<<<<<<<<<<<<
  20166     *                 prod = pr._new_c()
  20167     *                 for i in range(pr.n):
  20168     */
> 20169        __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Pleft), __pyx_n_s_domain_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1291, __pyx_L1_error)
  20170        __Pyx_GOTREF(__pyx_t_5);
  20171        __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Pright), __pyx_n_s_domain_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1291, __pyx_L1_error)
  20172        __Pyx_GOTREF(__pyx_t_4);
  20173        __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1291, __pyx_L1_error)
#10 0x00007f1d9a95fa10 in __pyx_pw_4sage_6groups_8perm_gps_17permgroup_element_23PermutationGroupElement_43__mul__ () at /home/marc/co/sage/src/sage/groups/perm_gps/permgroup_element.c:19858
  19853      CYTHON_UNUSED PyObject *const *__pyx_kwvalues;
  19854      PyObject *__pyx_r = 0;
  19855      __Pyx_RefNannyDeclarations
  19856      __Pyx_RefNannySetupContext("__mul__ (wrapper)", 0);
  19857      __pyx_kwvalues = __Pyx_KwValues_VARARGS(__pyx_args, __pyx_nargs);
> 19858      __pyx_r = __pyx_pf_4sage_6groups_8perm_gps_17permgroup_element_23PermutationGroupElement_42__mul__(((PyObject *)__pyx_v_left), ((PyObject *)__pyx_v_right));
  19859
  19860      /* function exit code */
  19861      __Pyx_RefNannyFinishContext();
  19862      return __pyx_r;
#11 0x0000000000599694 in binary_op1 () at /build/reproducible-path/python3.11-3.11.6/build-static/../Objects/abstract.c:901
#12 0x0000000000599680 in PyNumber_Multiply () at /build/reproducible-path/python3.11-3.11.6/build-static/../Objects/abstract.c:1111
#13 0x0000000000527670 in _PyEval_EvalFrameDefault () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/ceval.c:5539
#14 0x00000000005fdb52 in _PyEval_EvalFrame () at /build/reproducible-path/python3.11-3.11.6/build-static/../Include/internal/pycore_ceval.h:73
#15 0x00000000005fdb30 in _PyEval_Vector () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/ceval.c:6425
#16 0x00000000005fdab0 in PyEval_EvalCode () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/ceval.c:1140
#17 0x0000000000612ac2 in builtin_exec_impl () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/bltinmodule.c:1077
#18 0x0000000000612a50 in builtin_exec () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/clinic/bltinmodule.c.h:465
#19 0x0000000000527670 in _PyEval_EvalFrameDefault () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/ceval.c:5082
#20 0x00000000005c678a in _PyEval_EvalFrame () at /build/reproducible-path/python3.11-3.11.6/build-static/../Include/internal/pycore_ceval.h:73
#21 0x00000000005c6733 in gen_send_ex2 () at /build/reproducible-path/python3.11-3.11.6/build-static/../Objects/genobject.c:219
#22 0x00000000005c6733 in PyGen_am_send () at /build/reproducible-path/python3.11-3.11.6/build-static/../Objects/genobject.c:280
#23 0x00000000005c66f0 in PyIter_Send () at /build/reproducible-path/python3.11-3.11.6/build-static/../Objects/abstract.c:2882
#24 0x0000000000527670 in _PyEval_EvalFrameDefault () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/ceval.c:2577
#25 0x00000000005c678a in _PyEval_EvalFrame () at /build/reproducible-path/python3.11-3.11.6/build-static/../Include/internal/pycore_ceval.h:73
#26 0x00000000005c6733 in gen_send_ex2 () at /build/reproducible-path/python3.11-3.11.6/build-static/../Objects/genobject.c:219
#27 0x00000000005c6733 in PyGen_am_send () at /build/reproducible-path/python3.11-3.11.6/build-static/../Objects/genobject.c:280
#28 0x00000000005c66f0 in PyIter_Send () at /build/reproducible-path/python3.11-3.11.6/build-static/../Objects/abstract.c:2882
#29 0x0000000000527670 in _PyEval_EvalFrameDefault () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/ceval.c:2577
#30 0x000000000061058d in _PyEval_EvalFrame () at /build/reproducible-path/python3.11-3.11.6/build-static/../Include/internal/pycore_ceval.h:73
#31 0x00000000006104f0 in gen_send_ex2 () at /build/reproducible-path/python3.11-3.11.6/build-static/../Objects/genobject.c:219
#32 0x0000000000611150 in gen_send_ex () at /build/reproducible-path/python3.11-3.11.6/build-static/../Objects/genobject.c:287
#33 0x000000000055efb0 in method_vectorcall_O () at /build/reproducible-path/python3.11-3.11.6/build-static/../Objects/descrobject.c:481
#34 0x00000000005360c4 in _PyObject_VectorcallTstate () at /build/reproducible-path/python3.11-3.11.6/build-static/../Include/internal/pycore_call.h:92
#35 0x00000000005360b0 in PyObject_Vectorcall () at /build/reproducible-path/python3.11-3.11.6/build-static/../Objects/call.c:299
#36 0x0000000000527670 in _PyEval_EvalFrameDefault () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/ceval.c:4760
#37 0x00000000005fdb52 in _PyEval_EvalFrame () at /build/reproducible-path/python3.11-3.11.6/build-static/../Include/internal/pycore_ceval.h:73
#38 0x00000000005fdb30 in _PyEval_Vector () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/ceval.c:6425
#39 0x00000000005fdab0 in PyEval_EvalCode () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/ceval.c:1140
#40 0x0000000000618840 in run_eval_code_obj () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/pythonrun.c:1710
#41 0x0000000000615600 in run_mod () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/pythonrun.c:1731
#42 0x00000000006271d0 in pyrun_file () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/pythonrun.c:1626
#43 0x0000000000626e20 in _PyRun_SimpleFileObject () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/pythonrun.c:440
#44 0x0000000000626d90 in _PyRun_AnyFileObject () at /build/reproducible-path/python3.11-3.11.6/build-static/../Python/pythonrun.c:79
#45 0x0000000000625629 in pymain_run_file_obj () at /build/reproducible-path/python3.11-3.11.6/build-static/../Modules/main.c:360
#46 0x00000000006255f1 in pymain_run_file () at /build/reproducible-path/python3.11-3.11.6/build-static/../Modules/main.c:379
#47 0x000000000062540b in pymain_run_python () at /build/reproducible-path/python3.11-3.11.6/build-static/../Modules/main.c:601
#48 0x00000000006253f0 in Py_RunMain () at /build/reproducible-path/python3.11-3.11.6/build-static/../Modules/main.c:680
#49 0x00000000005f0f00 in Py_BytesMain () at /build/reproducible-path/python3.11-3.11.6/build-static/../Modules/main.c:734
#50 0x00007f1ded089650 in __libc_start_call_main () at ./csu/../sysdeps/nptl/libc_start_call_main.h:58
#51 0x00007f1ded089700 in __libc_start_main_impl () at ./csu/../csu/libc-start.c:360
#52 0x00000000005f0da0 in _start ()

@yeetkode yeetkode changed the title <title> RSK Kills Kernel Feb 23, 2024
@fchapoton fchapoton changed the title RSK Kills Kernel RSK on symmetric group element kills the kernel Feb 24, 2024
@tscrim
Copy link
Collaborator

tscrim commented Feb 29, 2024

I also confirmed and have found the main cause of the segfault:

sage: x = SymmetricGroup(5).random_element()
sage: [1] * x

This really should not happen. Note that this "works" (in the sense that it fails appropriately):

sage: x * [1]
TypeError: 'sage.groups.perm_gps.permgroup_element.SymmetricGroupElement' object cannot be interpreted as an integer

Also x.__rmul__([1]) segfaults.

Side note: the permutation group element still wouldn't work I think (as it iterates over cycles), which could (and should) be fixed independently without hiding the segfault. It would be a matter of implementing an _rsk_iter (which would be better than special casing by type IMO).

@darijgr You might want to be aware of these bugs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants