Sage: Ticket #11918: Sage should ship its Valgrind suppressions file, or not insist on its presence
https://trac.sagemath.org/ticket/11918
<p>
As reported on the IRC, running <code>sage --valgrind</code> (alias <code>sage --memcheck</code>) is apparently broken because the suppressions file is missing (and its directory, <code>$SAGE_LOCAL/lib/valgrind/</code>, doesn't exist).
</p>
<p>
Both <code>sage-valgrind</code> and <code>sage-doctest</code> seem to hardcode <code>$SAGE_LOCAL/lib/valgrind/sage.supp</code>.
</p>
<hr />
<p>
Unless we again(?) create and ship this file, we could at least add
</p>
<div class="wiki-code"><div class="code"><pre><span class="k">if</span> <span class="o">[[</span> ! -f <span class="s2">"$SAGE_LOCAL"</span>/lib/valgrind/sage.supp <span class="o">]]</span>; <span class="k">then
</span>mkdir -p <span class="s2">"$SAGE_LOCAL"</span>/lib/valgrind
touch <span class="s2">"$SAGE_LOCAL"</span>/lib/valgrind/sage.supp
<span class="k">fi</span>
</pre></div></div><p>
to <code>sage-valgrind</code>.
</p>
<p>
Using variables (perhaps also specifiable by the user) for both the directory and the filename would be better of course.
</p>
<p>
And / or only pass <code>--suppressions=...</code> if the file really exists.
</p>
en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/11918
Trac 1.1.6leifThu, 13 Oct 2011 12:37:57 GMTowner changed
https://trac.sagemath.org/ticket/11918#comment:1
https://trac.sagemath.org/ticket/11918#comment:1
<ul>
<li><strong>owner</strong>
changed from <em>leif</em> to <em>tbd</em>
</li>
</ul>
TicketleifThu, 13 Oct 2011 12:55:21 GMTdescription changed
https://trac.sagemath.org/ticket/11918#comment:2
https://trac.sagemath.org/ticket/11918#comment:2
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/11918?action=diff&version=2">diff</a>)
</li>
</ul>
TicketaapitzschWed, 26 Oct 2011 18:12:52 GMT
https://trac.sagemath.org/ticket/11918#comment:3
https://trac.sagemath.org/ticket/11918#comment:3
<p>
sage.supp is part of the optional valgrind package which BTW is out of date.
</p>
<p>
According to <a class="ext-link" href="http://groups.google.com/group/sage-devel/browse_thread/thread/1657cccac33c9dd7"><span class="icon"></span>http://groups.google.com/group/sage-devel/browse_thread/thread/1657cccac33c9dd7</a>
</p>
<blockquote>
<p>
The suppression file gets rid of a bunch of annoying issues introduced by zlib and Cython.
</p>
</blockquote>
<p>
Is this still necessary?
</p>
TicketleifWed, 26 Oct 2011 18:44:52 GMT
https://trac.sagemath.org/ticket/11918#comment:4
https://trac.sagemath.org/ticket/11918#comment:4
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/11918#comment:3" title="Comment 3">aapitzsch</a>:
</p>
<blockquote class="citation">
<p>
sage.supp is part of the optional valgrind package which BTW is out of date.
</p>
</blockquote>
<p>
Yes, but it's IMHO pointless to install an (almost always) obsolete spkg just to get a file which consists of only a few lines. It should be part of the standard distribution.
</p>
<p>
(More recent <code>valgrind</code> versions are either already installed or at least available as a "native" package in any reasonable distro. Moreover, I don't think one would <em>only</em> use it for Sage. Note also that usually <code>valgrind</code> has to be updated each time new processor instructions / ISA extensions come up.)
</p>
<p>
Not testing for its presence (btw. without any meaningful error message from Sage's side) is certainly a bug.
</p>
<p>
<br />
</p>
<blockquote class="citation">
<p>
"The suppression file gets rid of a bunch of annoying issues introduced by zlib and Cython."
</p>
<p>
Is this still necessary?
</p>
</blockquote>
<p>
I think so, but it should be kept up-to-date anyway.
</p>
TicketleifWed, 26 Oct 2011 18:48:30 GMTkeywords, summary changed
https://trac.sagemath.org/ticket/11918#comment:5
https://trac.sagemath.org/ticket/11918#comment:5
<ul>
<li><strong>keywords</strong>
<em>--valgrind</em> added
</li>
<li><strong>summary</strong>
changed from <em>`sage --valgrind` etc. apparently broken</em> to <em>Sage should ship its Valgrind suppressions file, or not insist on its presence</em>
</li>
</ul>
TicketleifWed, 26 Oct 2011 18:52:21 GMT
https://trac.sagemath.org/ticket/11918#comment:6
https://trac.sagemath.org/ticket/11918#comment:6
<p>
P.S.: Thanks for bringing this ticket back to my mind. We recently had some discussion on the IRC regarding the spkg, but I completely forgot about the ticket... ;-)
</p>
TicketroedFri, 22 Jun 2012 23:58:30 GMTcc set
https://trac.sagemath.org/ticket/11918#comment:7
https://trac.sagemath.org/ticket/11918#comment:7
<ul>
<li><strong>cc</strong>
<em>roed</em> added
</li>
</ul>
TicketSimonKingThu, 30 Aug 2012 20:54:43 GMTcc changed
https://trac.sagemath.org/ticket/11918#comment:8
https://trac.sagemath.org/ticket/11918#comment:8
<ul>
<li><strong>cc</strong>
<em>SimonKing</em> added
</li>
</ul>
TicketnbruinThu, 30 Aug 2012 21:00:49 GMTattachment set
https://trac.sagemath.org/ticket/11918
https://trac.sagemath.org/ticket/11918
<ul>
<li><strong>attachment</strong>
set to <em>sage.supp</em>
</li>
</ul>
<p>
sage-valgrind suppression file (store as $SAGE_LOCAL/lib/valgrind/sage.supp)
</p>
TicketnbruinThu, 30 Aug 2012 21:03:58 GMT
https://trac.sagemath.org/ticket/11918#comment:9
https://trac.sagemath.org/ticket/11918#comment:9
<p>
Until this ticket is fixed, I've attached <a class="attachment" href="https://trac.sagemath.org/attachment/ticket/11918/sage.supp" title="Attachment 'sage.supp' in Ticket #11918">sage.supp</a><a class="trac-rawlink" href="https://trac.sagemath.org/raw-attachment/ticket/11918/sage.supp" title="Download"></a>, which might help people with using valgrind in the mean time. File should be at
<code>$SAGE_LOCAL/lib/valgrind/sage.supp</code> to be picked up. NOTE: This is <code>sage-liberal.supp</code> from the spkg.
</p>
TicketSimonKingThu, 30 Aug 2012 21:21:59 GMT
https://trac.sagemath.org/ticket/11918#comment:10
https://trac.sagemath.org/ticket/11918#comment:10
<p>
Hi Nils,
</p>
<p>
thank you for the sage.supp at <a class="closed ticket" href="https://trac.sagemath.org/ticket/11918" title="defect: Sage should ship its Valgrind suppressions file, or not insist on its ... (closed: fixed)">#11918</a>! When I run the tests of sage/rings/polynomial/infinite_polynomial_ring.py (which make Volker's patchbot at <a class="closed ticket" href="https://trac.sagemath.org/ticket/12876" title="enhancement: Fix element and parent classes of Hom categories to be abstract, and ... (closed: fixed)">#12876</a> segfault, even though they are fine for me, I do not get a SIGILL. But I do get a considerable amount of lost memory:
</p>
<pre class="wiki">==13541== 13,936 bytes in 1 blocks are definitely lost in loss record 8,673 of 8,997
==13541== at 0x4C244E8: malloc (vg_replace_malloc.c:236)
==13541== by 0x21E8984F: omAllocFromSystem (omAllocSystem.c:184)
==13541== by 0x21E89A21: omAllocLarge (omAllocSystem.c:39)
==13541== by 0x21BB3A00: iiAllStart(procinfo*, char*, feBufferTypes, int) (omalloc.h:2432)
==13541== by 0x21BB3B95: iiPStart(idrec*, sleftv*) (iplib.cc:360)
==13541== by 0x21BB4148: iiMake_proc(idrec*, sip_package*, sleftv*) (iplib.cc:482)
==13541== by 0x2239B64D: __pyx_f_4sage_4libs_8singular_8function_call_function(__pyx_obj_4sage_4libs_8singular_8function_SingularFunction*, _object*, _object*, __pyx_opt_args_4sage_4libs_8singular_8f
unction_call_function*) (function.cpp:13241)
==13541== by 0x2239CBA8: __pyx_pw_4sage_4libs_8singular_8function_16SingularFunction_5__call__(_object*, _object*, _object*) (function.cpp:11924)
==13541== by 0x4E742C2: PyObject_Call (abstract.c:2529)
==13541== by 0x4F160FC: PyEval_EvalFrameEx (ceval.c:4239)
==13541== by 0x4F19124: PyEval_EvalCodeEx (ceval.c:3253)
==13541== by 0x4E9C122: function_call (funcobject.c:526)
==13541== by 0x4E742C2: PyObject_Call (abstract.c:2529)
==13541== by 0x4F14C59: PyEval_EvalFrameEx (ceval.c:4334)
==13541== by 0x4F19124: PyEval_EvalCodeEx (ceval.c:3253)
==13541== by 0x4E9C122: function_call (funcobject.c:526)
==13541== by 0x4E742C2: PyObject_Call (abstract.c:2529)
==13541== by 0x4F14C59: PyEval_EvalFrameEx (ceval.c:4334)
==13541== by 0x4F19124: PyEval_EvalCodeEx (ceval.c:3253)
==13541== by 0x4E9C122: function_call (funcobject.c:526)
==13541== by 0x4E742C2: PyObject_Call (abstract.c:2529)
==13541== by 0xB29B841: __pyx_pw_4sage_4misc_9cachefunc_12CachedMethod_3_instance_call (cachefunc.c:9733)
==13541== by 0x4E742C2: PyObject_Call (abstract.c:2529)
==13541== by 0xB29C7D4: __pyx_pw_4sage_4misc_9cachefunc_18CachedMethodCaller_7__call__ (cachefunc.c:7254)
==13541== by 0x4E742C2: PyObject_Call (abstract.c:2529)
</pre><p>
Is there a way to find out what singular_function or what cached method are involved?
</p>
TicketnbruinThu, 30 Aug 2012 21:58:34 GMT
https://trac.sagemath.org/ticket/11918#comment:11
https://trac.sagemath.org/ticket/11918#comment:11
<p>
Isn't it telling you?
</p>
<pre class="wiki">==13541== by 0x2239B64D: __pyx_f_4sage_4libs_8singular_8function_call_function(__pyx_obj_4sage_4libs_8singular_8function_SingularFunction*, _object*, _object*, __pyx_f_4sage_4libs_8singular_8function_call_function(__pyx_obj_4sage_4libs_8singular_8function_SingularFunction*, _object*, _object*, __pyx_opt_args_4sage_4libs_8singular_8f
unction_call_function*) (function.cpp:13241)
==13541== by 0x2239CBA8: __pyx_pw_4sage_4libs_8singular_8function_16SingularFunction_5__call__(_object*, _object*, _object*) (function.cpp:11924)
</pre><p>
You should be able to look that line up: <code>(function.cpp:11924)</code>. I suppose that's a cython generated file, so the context there will tell you which function this is in the corresponding <code>function.pyx</code> file.
</p>
<p>
I have no experience with valgrind myself. However, I think Python's memory management can confuse valgrind quite a bit. I was actually more hoping for a "double free" or "access to freed memory block" type error (i.e., illegal use of a pointer value.)
</p>
<p>
It may well be that my SIGILL is indeed a matter of mpfr on Corei7 compiling to something that's too fancy for valgrind and not a pointer to an error.
</p>
TicketSimonKingThu, 30 Aug 2012 22:02:07 GMT
https://trac.sagemath.org/ticket/11918#comment:12
https://trac.sagemath.org/ticket/11918#comment:12
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/11918#comment:11" title="Comment 11">nbruin</a>:
</p>
<blockquote class="citation">
<p>
Isn't it telling you?
</p>
</blockquote>
<p>
No, it isn't. It just tells that it is a singular_function (as defined in sage.libs.singular.function), but it could be any function of Singular (std, slimgb, reduce, system, ...)
</p>
TicketnbruinThu, 30 Aug 2012 22:21:15 GMT
https://trac.sagemath.org/ticket/11918#comment:13
https://trac.sagemath.org/ticket/11918#comment:13
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/11918#comment:12" title="Comment 12">SimonKing</a>:
</p>
<blockquote class="citation">
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/11918#comment:11" title="Comment 11">nbruin</a>:
</p>
<blockquote class="citation">
<p>
Isn't it telling you?
</p>
</blockquote>
<p>
No, it isn't. It just tells that it is a singular_function (as defined in sage.libs.singular.function), but it could be any function of Singular (std, slimgb, reduce, system, ...)
</p>
</blockquote>
<p>
Oh, right. That's going to just as opaque as debugging python code with gdb then. I guess you could try and set a breakpoint at the function and then investigate the arguments? It's triggering <code>iiPStart</code> though. That might tell you something?
</p>
<p>
Anyway, given that there's a good chance this is a false positive anyway, perhaps this call sequence might not be the one to concentrate on. I'd imagine <code>omalloc</code> plays tricks that would confuse valgrind (it's an advanced memory manager after all!), so <code>malloc</code> "losing" memory doesn't sound particularly worrisome to me.
</p>
TicketjdemeyerTue, 13 Aug 2013 15:35:53 GMTmilestone changed
https://trac.sagemath.org/ticket/11918#comment:14
https://trac.sagemath.org/ticket/11918#comment:14
<ul>
<li><strong>milestone</strong>
changed from <em>sage-5.11</em> to <em>sage-5.12</em>
</li>
</ul>
TicketSimonKingThu, 15 Aug 2013 07:55:09 GMT
https://trac.sagemath.org/ticket/11918#comment:15
https://trac.sagemath.org/ticket/11918#comment:15
<p>
Ping! Is anybody inclined to fix this? Sorry that my knowledge of valgrind is too limited for doing this myself.
</p>
Ticketvbraun_spamThu, 30 Jan 2014 21:20:52 GMTmilestone changed
https://trac.sagemath.org/ticket/11918#comment:16
https://trac.sagemath.org/ticket/11918#comment:16
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.1</em> to <em>sage-6.2</em>
</li>
</ul>
Ticketvbraun_spamTue, 06 May 2014 15:20:58 GMTmilestone changed
https://trac.sagemath.org/ticket/11918#comment:17
https://trac.sagemath.org/ticket/11918#comment:17
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.2</em> to <em>sage-6.3</em>
</li>
</ul>
Ticketvbraun_spamSun, 10 Aug 2014 16:51:03 GMTmilestone changed
https://trac.sagemath.org/ticket/11918#comment:18
https://trac.sagemath.org/ticket/11918#comment:18
<ul>
<li><strong>milestone</strong>
changed from <em>sage-6.3</em> to <em>sage-6.4</em>
</li>
</ul>
TicketaapitzschSun, 12 Oct 2014 21:02:42 GMTstatus, milestone changed
https://trac.sagemath.org/ticket/11918#comment:19
https://trac.sagemath.org/ticket/11918#comment:19
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
<li><strong>milestone</strong>
changed from <em>sage-6.4</em> to <em>sage-duplicate/invalid/wontfix</em>
</li>
</ul>
<p>
This has been fixed with <a class="closed ticket" href="https://trac.sagemath.org/ticket/15586" title="enhancement: Update Valgrind to 3.10.0 (closed: fixed)">#15586</a>.
</p>
TicketvbraunSat, 25 Oct 2014 21:46:11 GMTstatus changed; reviewer, resolution set
https://trac.sagemath.org/ticket/11918#comment:20
https://trac.sagemath.org/ticket/11918#comment:20
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>closed</em>
</li>
<li><strong>reviewer</strong>
set to <em>Volker Braun</em>
</li>
<li><strong>resolution</strong>
set to <em>fixed</em>
</li>
</ul>
Ticket