Sage: Ticket #13636: %timeit unpickle_all() causes a SEGABRT
https://trac.sagemath.org/ticket/13636
<p>
<strong>CLOSED AS DUPLICATE OF <a class="closed ticket" href="https://trac.sagemath.org/ticket/10705" title="defect: unpickle_all called twice = boom! (closed: wontfix)">#10705</a></strong>
</p>
<p>
The subject says it all:
Sage gives a SEGABRT with the following:
</p>
<pre class="wiki">sage: %timeit sage.structure.sage_object.unpickle_all()
------------------------------------------------------------------------
Unhandled SIGABRT: An abort() 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.
------------------------------------------------------------------------
/usr/local/src/sage/sage-5.4.rc1/spkg/bin/sage: line 310: 60549 Abort trap: 6 sage-ipython "$@" -i
</pre><p>
Note, however, that the following is OK:
</p>
<pre class="wiki">sage: sage.structure.sage_object.unpickle_all()
/usr/local/src/sage/sage-5.4.rc1/local/lib/python2.7/site-packages/IPython/iplib.py:2260: DeprecationWarning: This class is replaced by Matrix_modn_dense_float/Matrix_modn_dense_double.
See http://trac.sagemath.org/4260 for details.
exec code_obj in self.user_global_ns, self.user_ns
Successfully unpickled 594 objects.
Failed to unpickle 0 objects.
</pre><p>
as is calling <code>unpickle()</code> with an argument:
</p>
<pre class="wiki">sage: sage: dir = tmp_dir()
sage: sage: sage.structure.sage_object.picklejar('hello', dir)
sage: sage: sage.structure.sage_object.unpickle_all(dir)
Successfully unpickled 1 objects.
Failed to unpickle 0 objects.
sage: %timeit sage.structure.sage_object.unpickle_all(dir)
625 loops, best of 3: 91.5 Âµs per loop
</pre><p>
I get this error for versions 5.3 and 5.4.rc1 running on a macbook pro with lion.
</p>
<p>
I initially thought that perhaps timeit did not like calling itself, however, this seems to be OK because the following does work:
</p>
<pre class="wiki">sage: def fred():^J timeit('2^10000', preparse=False, number=100)
....:
sage: fred()
100 loops, best of 3: 31 ns per loop
sage: %timeit fred
625 loops, best of 3: 38.5 ns per loop
</pre><p>
I tried running through sage -gdb but I don't know how to interpret the outout. Here is the tail of what it produces:
</p>
<pre class="wiki">Reading symbols for shared libraries warning: .o file "/usr/local/src/sage/sage-5.3/devel/sage-main/build/temp.macosx-10.7-x86_64-2.7/sage/matrix/matrix_symbolic_dense.o" more recent than executable timestamp in "/usr/local/src/sage/sage-5.3/devel/sage-combinat/build/sage/matrix/matrix_symbolic_dense.so"
warning: Could not open OSO file /usr/local/src/sage/sage-5.3/devel/sage-main/build/temp.macosx-10.7-x86_64-2.7/sage/matrix/matrix_symbolic_dense.o to scan for pubtypes for objfile /usr/local/src/sage/sage-5.3/devel/sage-combinat/build/sage/matrix/matrix_symbolic_dense.so
. done
Reading symbols for shared libraries warning: .o file "/usr/local/src/sage/sage-5.3/devel/sage-main/build/temp.macosx-10.7-x86_64-2.7/sage/rings/polynomial/symmetric_reduction.o" more recent than executable timestamp in "/usr/local/src/sage/sage-5.3/devel/sage-combinat/build/sage/rings/polynomial/symmetric_reduction.so"
warning: Could not open OSO file /usr/local/src/sage/sage-5.3/devel/sage-main/build/temp.macosx-10.7-x86_64-2.7/sage/rings/polynomial/symmetric_reduction.o to scan for pubtypes for objfile /usr/local/src/sage/sage-5.3/devel/sage-combinat/build/sage/rings/polynomial/symmetric_reduction.so
. done
Program received signal SIGABRT, Aborted.
0x00007fff8d58f82a in __kill ()
</pre>en-usSagehttps://trac.sagemath.org/chrome/site/logo_sagemath_trac.png
https://trac.sagemath.org/ticket/13636
Trac 1.1.6andrew.mathasMon, 22 Oct 2012 02:31:20 GMTdescription changed
https://trac.sagemath.org/ticket/13636#comment:1
https://trac.sagemath.org/ticket/13636#comment:1
<ul>
<li><strong>description</strong>
modified (<a href="/ticket/13636?action=diff&version=1">diff</a>)
</li>
</ul>
TicketnbruinMon, 22 Oct 2012 03:34:51 GMT
https://trac.sagemath.org/ticket/13636#comment:2
https://trac.sagemath.org/ticket/13636#comment:2
<p>
Usually asking for the stack backtrace is one of the most interesting things:
</p>
<pre class="wiki">Program received signal SIGABRT, Aborted.
0x00000031cfe36285 in raise () from /lib64/libc.so.6
...
(gdb) bt
#0 0x00000031cfe36285 in raise () from /lib64/libc.so.6
#1 0x00000031cfe37b9b in abort () from /lib64/libc.so.6
#2 0x00007fffed336797 in global_NTL_error_callback () from /usr/local/sage/5.0/local/lib/libcsage.so
#3 0x00007fffece36eaf in NTL::Error (s=0x7fffece6b6b2 "InvMod: inverse undefined") at tools.c:48
#4 0x00007fffecd8b5c6 in NTL::InvMod (a=<optimized out>, n=244) at ZZ.c:351
#5 0x00007fffecdfb18c in inv (a=<optimized out>, x=<synthetic pointer>) at ../include/NTL/lzz_p.h:278
#6 NTL::PlainRem (r=..., a=..., b=<optimized out>) at lzz_pX.c:1083
#7 0x00007fffece054c1 in NTL::GCD (d=..., u=<optimized out>, v=...) at lzz_pX1.c:558
#8 0x00007fffd99939a8 in GCD (b=..., a=...) at /usr/local/sage/5.0/local/include/NTL/lzz_pX.h:696
#9 gcd_univar_ntlp (G=..., F=...) at cf_gcd.cc:1036
#10 gcd_poly_p (f=<optimized out>, g=...) at cf_gcd.cc:546
#11 0x00007fffd998f272 in gcd_poly (f=..., g=...) at cf_gcd.cc:718
#12 0x00007fffd998f954 in gcd (f=..., g=...) at cf_gcd.cc:952
#13 0x00007fffd998fdaf in cf_content (f=..., g=...) at cf_gcd.cc:798
#14 0x00007fffd998ff58 in content (f=..., x=...) at cf_gcd.cc:851
#15 0x00007fffd998feed in content (f=..., x=...) at cf_gcd.cc:855
#16 0x00007fffd99b5966 in EZGCD_P (FF=<optimized out>, GG=<optimized out>) at cf_gcd_smallp.cc:4168
#17 0x00007fffd998f0fe in gcd_poly (f=..., g=...) at cf_gcd.cc:704
#18 0x00007fffd998e0ce in chinrem_gcd (FF=<optimized out>, GG=<optimized out>) at cf_gcd.cc:1195
#19 0x00007fffd998f156 in gcd_poly (f=..., g=...) at cf_gcd.cc:743
#20 0x00007fffd998f954 in gcd (f=..., g=...) at cf_gcd.cc:952
#21 0x00007fffd97f7a76 in singclap_gcd_r (f=0x7fffd966a328, g=0x7fffd966a1e8, r=0x7fffd96371a0) at clapsing.cc:53
#22 0x00007fffd97f7c59 in singclap_gcd (f=0x7fffd966a328, g=0x7fffd966a1e8) at clapsing.cc:109
#23 0x00007fffd9d939df in __pyx_pf_4sage_5rings_10polynomial_28multi_polynomial_libsingular_23MPolynomial_libsingular_52gcd (__pyx_v_self=0x5568500, __pyx_args=<optimized out>, __pyx_kwds=<optimized out>)
at sage/rings/polynomial/multi_polynomial_libsingular.cpp:26669
#24 0x00007ffff7c711d3 in PyObject_Call (func=0x53a35f0, arg=<optimized out>, kw=<optimized out>)
at Objects/abstract.c:2529
#25 0x00007ffff7d0e677 in PyEval_CallObjectWithKeywords (func=0x53a35f0, arg=0x54b8210, kw=<optimized out>)
at Python/ceval.c:3882
#26 0x00007ffff7c87cec in methoddescr_call (descr=<optimized out>, args=0x54b8210, kwds=0x5554ab0)
at Objects/descrobject.c:247
#27 0x00007ffff7c711d3 in PyObject_Call (func=0x1471f38, arg=<optimized out>, kw=<optimized out>)
at Objects/abstract.c:2529
#28 0x00007ffff7d0e677 in PyEval_CallObjectWithKeywords (func=0x1471f38, arg=0x54cbdd0, kw=<optimized out>)
at Python/ceval.c:3882
#29 0x00007fffe9f911c2 in __pyx_pf_4sage_9structure_7element_16NamedBinopMethod_1__call__ (__pyx_v_self=0x54dabd8,
...
#91 0x00007ffff7d15bd5 in PyEval_EvalCodeEx (co=<optimized out>, globals=<optimized out>, locals=<optimized out>,
args=<optimized out>, argcount=1, kws=0x6f32e0, kwcount=2, defs=0x7fffee2bf068, defcount=2, closure=0x0)
at Python/ceval.c:3253
#92 0x00007ffff7d13e51 in fast_function (nk=<optimized out>, na=1, n=<optimized out>, pp_stack=0x7fffffffd640,
func=0x7fffed7add70) at Python/ceval.c:4109
#93 call_function (oparg=<optimized out>, pp_stack=0x7fffffffd640) at Python/ceval.c:4034
</pre><p>
So, the error happens in NTL. I suppose that this is an error that normally gets caught appropriately but due to <code>%timeit</code> doesn't? The alternative is that the whole <code>%timeit</code> thing happens to cause a state in NTL we aren't normally encountering.
</p>
Ticketandrew.mathasFri, 25 Jan 2013 00:50:32 GMT
https://trac.sagemath.org/ticket/13636#comment:3
https://trac.sagemath.org/ticket/13636#comment:3
<p>
See <a class="closed ticket" href="https://trac.sagemath.org/ticket/10705" title="defect: unpickle_all called twice = boom! (closed: wontfix)">#10705</a> for another seg fault associated with unpickle_all.
</p>
TicketnbruinFri, 25 Jan 2013 01:04:34 GMT
https://trac.sagemath.org/ticket/13636#comment:4
https://trac.sagemath.org/ticket/13636#comment:4
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/13636#comment:3" title="Comment 3">andrew.mathas</a>:
</p>
<blockquote class="citation">
<p>
See <a class="closed ticket" href="https://trac.sagemath.org/ticket/10705" title="defect: unpickle_all called twice = boom! (closed: wontfix)">#10705</a> for another seg fault associated with unpickle_all.
</p>
</blockquote>
<p>
Well ... <code>%timeit</code> will run its code a couple of times to get accurate timing information, so if (as the ticket mentions) running <code>unpickle_all()</code> twice causes a crash then <code>%timeit unpickle_all()</code> should too.
</p>
Ticketandrew.mathasFri, 25 Jan 2013 01:19:41 GMTstatus, description, milestone changed
https://trac.sagemath.org/ticket/13636#comment:5
https://trac.sagemath.org/ticket/13636#comment:5
<ul>
<li><strong>status</strong>
changed from <em>new</em> to <em>needs_review</em>
</li>
<li><strong>description</strong>
modified (<a href="/ticket/13636?action=diff&version=5">diff</a>)
</li>
<li><strong>milestone</strong>
changed from <em>sage-5.7</em> to <em>sage-duplicate/invalid/wontfix</em>
</li>
</ul>
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/13636#comment:4" title="Comment 4">nbruin</a>:
</p>
<blockquote class="citation">
<p>
Replying to <a class="ticket" href="https://trac.sagemath.org/ticket/13636#comment:3" title="Comment 3">andrew.mathas</a>:
</p>
<blockquote class="citation">
<p>
See <a class="closed ticket" href="https://trac.sagemath.org/ticket/10705" title="defect: unpickle_all called twice = boom! (closed: wontfix)">#10705</a> for another seg fault associated with unpickle_all.
</p>
</blockquote>
<p>
Well ... <code>%timeit</code> will run its code a couple of times to get accurate timing information, so if (as the ticket mentions) running <code>unpickle_all()</code> twice causes a crash then <code>%timeit unpickle_all()</code> should too.
</p>
</blockquote>
<p>
OK, let's close this as a duplicate then. I'll set it as needs review. Could you please "review" it Nils?
</p>
TickettscrimWed, 20 Mar 2013 23:15:51 GMTstatus changed; reviewer set
https://trac.sagemath.org/ticket/13636#comment:6
https://trac.sagemath.org/ticket/13636#comment:6
<ul>
<li><strong>status</strong>
changed from <em>needs_review</em> to <em>positive_review</em>
</li>
<li><strong>reviewer</strong>
set to <em>Travis Scrimshaw</em>
</li>
</ul>
<p>
I agree that this is a duplicate.
</p>
TicketjdemeyerFri, 29 Mar 2013 18:56:35 GMTstatus changed; resolution set
https://trac.sagemath.org/ticket/13636#comment:7
https://trac.sagemath.org/ticket/13636#comment:7
<ul>
<li><strong>status</strong>
changed from <em>positive_review</em> to <em>closed</em>
</li>
<li><strong>resolution</strong>
set to <em>duplicate</em>
</li>
</ul>
Ticket