Segmentation Fault in coerce_actions.c

1 view
Skip to first unread message

Daniel Bump

unread,
Dec 16, 2009, 10:09:00 AM12/16/09
to sage-...@googlegroups.com

I will explain how to make sage have a segmentation fault
with the following alarming message:

------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occured in SAGE.
This probably occured because a *compiled* component
of SAGE has a bug in it (typically accessing invalid memory)
or is not properly wrapped with _sig_on, _sig_off.
You might want to run SAGE under gdb with 'sage -gdb' to debug this.
SAGE will now terminate (sorry).
------------------------------------------------------------

Apply the following patch to sage-4.3.rc0:

http://sporadic.stanford.edu/bump/patches/coerce_actions_segfault.patch

This creates a file called sage/algebras/iwahori.py. Eventually
it will make the Iwahori Hecke algebra of a Weyl group but
at the moment it just makes the group algebra. You can do
stuff like this:

sage: H = WeylGroupAlgebra("B3")
sage: [T1,T2,T3]=H.simple_reflections()
sage: (T2*T3)^4
1
sage: (T1*T2)^3
1

Unfortunately you can get a crash by evaluating 2*T1.

A backtrace with gdb shows frames in coerce_actions.c,
coerce.c, parent.c, parent_old.c and element.c, all
in sage/structure/ with corresponding cython files *.pyx.

To get the backtrace, run sage -gdb, make it crash, then
type bt at the gdb prompt.

Examination of the backtrace led to the following more
direct way of causing the crash:

sage: WeylGroupAlgebra("A2").get_action(ZZ)

I can probably work around this by writing a
new _get_action_ method, so maybe this is not
such a severe bug. But I am reporting it here.

If it is deemed severe I will make a trac ticket.

Daniel Bump

David Roe

unread,
Dec 16, 2009, 2:43:23 PM12/16/09
to sage-...@googlegroups.com
Any time writing in pure python causes a segfault is a serious bug.

Glancing briefly at the code, I have a few ideas for what might have caused it: I'll take a more detailed look in an hour or two.

Regardless of what's causing the crash, I'd suggest you use the methods described at http://www.sagemath.org/doc/reference/coercion.html rather than implementing your own __call__, _coerce_impl on the parent.  It's also a good idea to use parent() rather than setting self._parent = A directly in your __init__ method.

I'll get back to you soon with (hopefully) a reason why it's crashing.
David

On Wed, Dec 16, 2009 at 10:09 AM, Daniel Bump <bu...@match.stanford.edu> wrote:

I will explain how to make sage have a segmentation fault
with the following alarming message:

------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occured in SAGE.
This probably occured because a *compiled* component
of SAGE has a bug in it (typically accessing invalid memory)
or is not properly wrapped with _sig_on, _sig_off.
You might want to run SAGE under gdb with 'sage -gdb' to debug this.
SAGE will now terminate (sorry).
------------------------------------------------------------

Apply the following patch to sage-4.3.rc0:
t

--
To post to this group, send an email to sage-...@googlegroups.com
To unsubscribe from this group, send an email to sage-devel+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply all
Reply to author
Forward
0 new messages