#13731: Fix libsingular memory management
--------------------------------------------------------------+-------------
Reporter: nbruin | Owner:
rlm
Type: defect | Status:
new
Priority: major | Milestone:
sage-5.6
Component: memleak | Resolution:
Keywords: | Work issues:
Report Upstream: Fixed upstream, in a later stable release. | Reviewers:
Authors: Nils Bruin, Simon King | Merged in:
Dependencies: | Stopgaps:
--------------------------------------------------------------+-------------
Comment (by SimonKing):
The
[http://sage.math.washington.edu/home/SimonKing/SAGE/spkgs/singular-3-1-5.p2.spkg
new Singular spkg] is intended to eventually become a new patch level of
the standard Singular spkg.
The spkg is not ready for review yet (for example, SPKG.txt needs to be
updated, and there are uncommited changes). But it contains two bug fixes
from upstream, it builds on Linux and OSX, and one can ''opionally'' build
libsingular and the Singular executable based on xalloc.
The disadvantage is that there are much more changes to the upstream
sources compared with Nils' spkg. So, it could very well be that in the
xalloc version one sees bugs that are actually artefacts of totally
stripping down omalloc.
Here is what happens with the new spkg, build with `export
SINGULAR_XALLOC=yes` on my !openSuse laptop:
'''__Without MALLOC_CHECK__'''
* Sage can not quit after executing a very basic polynomial arithmetics:
{{{
sage: P.<x,y> = QQ[]
sage: x*y
x*y
sage: quit
Exiting Sage (CPU time 0m0.04s, Wall time 0m3.72s).
}}}
The shell prompt does not return, ctrl-C has no effect - I have to pkill
all Python processes! Note that `P.<x,y>=QQ[]` alone does ''not'' trigger
the problem.
* In the example from the ticket description, one does not get a crash
when multiplying two elements of a g-algebra, but one gets a crash when
quitting Sage afterwards:
{{{
sage: A.<x,y> = FreeAlgebra(QQ, 2)
sage: P.<x,y> = A.g_algebra({y*x:-x*y})
sage: x*y
x*y
sage: quit
Exiting Sage (CPU time 0m0.19s, Wall time 0m19.09s).
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libcsage.so(print_backtrace+0x31)[0x7f951301ac77]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libcsage.so(sigdie+0x14)[0x7f951301aca9]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libcsage.so(sage_signal_handler+0x216)[0x7f951301a886]
/lib64/libpthread.so.0(+0xfd00)[0x7f95183f0d00]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(+0x129940)[0x7f9518727940]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(PyGC_Collect+0x24)[0x7f9518728694]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(Py_Finalize+0x116)[0x7f9518714316]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(Py_Exit+0x8)[0x7f9518713308]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(+0x115434)[0x7f9518713434]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(PyErr_PrintEx+0x205)[0x7f95187136d5]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(PyRun_SimpleFileExFlags+0x1fe)[0x7f9518713b4e]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(Py_Main+0xbd5)[0x7f9518727035]
/lib64/libc.so.6(__libc_start_main+0xed)[0x7f9517a1423d]
python[0x4006e1]
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred in Sage.
This probably occurred because a *compiled* component of Sage has a bug
in it and 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.
------------------------------------------------------------------------
/home/simon/SAGE/debug/sage-5.5.rc0/spkg/bin/sage: Zeile 310: 5308
Speicherzugriffsfehler sage-ipython "$@" -i
}}}
'''__With `export MALLOC_CHECK=3`__'''
* Sage crashes when quitting after executing a very basic polynomial
arithmetics:
{{{
sage: P.<x,y> = QQ[]
sage: x*y
x*y
sage:
Exiting Sage (CPU time 0m0.05s, Wall time 0m26.09s).
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libcsage.so(print_backtrace+0x31)[0x7fcc69d1ac77]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libcsage.so(sigdie+0x14)[0x7fcc69d1aca9]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libcsage.so(sage_signal_handler+0x216)[0x7fcc69d1a886]
/lib64/libpthread.so.0(+0xfd00)[0x7fcc6f339d00]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(+0x1296d8)[0x7fcc6f6706d8]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(+0x75bca)[0x7fcc6f5bcbca]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(+0x129977)[0x7fcc6f670977]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(PyGC_Collect+0x24)[0x7fcc6f671694]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(Py_Finalize+0x116)[0x7fcc6f65d316]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(Py_Exit+0x8)[0x7fcc6f65c308]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(+0x115434)[0x7fcc6f65c434]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(PyErr_PrintEx+0x205)[0x7fcc6f65c6d5]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(PyRun_SimpleFileExFlags+0x1fe)[0x7fcc6f65cb4e]
/home/simon/SAGE/debug/sage-5.5.rc0/local/lib/libpython2.7.so.1.0(Py_Main+0xbd5)[0x7fcc6f670035]
/lib64/libc.so.6(__libc_start_main+0xed)[0x7fcc6e95d23d]
python[0x4006e1]
------------------------------------------------------------------------
Unhandled SIGSEGV: A segmentation fault occurred in Sage.
This probably occurred because a *compiled* component of Sage has a bug
in it and 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.
------------------------------------------------------------------------
/home/simon/SAGE/debug/sage-5.5.rc0/spkg/bin/sage: Zeile 310: 5393
Speicherzugriffsfehler sage-ipython "$@" -i
}}}
* There is a memory corruption detected already when creating the
g-algebra. The Sage or shell prompt does not appear, ctrl-C has no effect,
I need to pkill python:
{{{
sage: A.<x,y> = FreeAlgebra(QQ, 2)
sage: P.<x,y> = A.g_algebra({y*x:-x*y})
*** glibc detected *** python: malloc(): memory corruption:
0x0000000002c8db40 ***
}}}
Two upstream bugs were fixed in the new spkg. Now the question is whether
the findings above will point to further upstream bugs or are simply
consequences of the rather brutal approach of replacing omalloc with
xalloc.
Nils, can you analyse what is happening here? You are a lot better than I
in using gdb and valgrind.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13731#comment:90>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.