On Wednesday, November 14, 2012 5:42:27 PM UTC-6, Nils Bruin wrote:
>
> However, in an effort to make memory errors during testing a little 
> more reproducible I made this little edit to local/bin/sagedoctest.py 
> to ensure the garbage collector is run before every doctested line: 
>
> -------------------------------------------------------------------- 
> diff --git a/sagedoctest.py b/sagedoctest.py 
> --- a/sagedoctest.py 
> +++ b/sagedoctest.py 
> @@ -1,7 +1,9 @@ 
>  from __future__ import with_statement 
>
>  import ncadoctest 
> +import gc 
>  import sage.misc.randstate as randstate 
> +import sys 
>
>  OrigDocTestRunner = ncadoctest.DocTestRunner 
>  class SageDocTestRunner(OrigDocTestRunner): 
> @@ -35,6 +37,8 @@ class SageDocTestRunner(OrigDocTestRunne 
>                  except Exception, e: 
>                      self._timeit_stats[key] = e 
>          # otherwise, just run the example 
> +        sys.stderr.write('testing example %s\n'%example) 
> +        gc.collect() 
>          OrigDocTestRunner.run_one_example(self, test, example, 
> filename, compileflags) 
>
>      def save_timeit_stats_to_file_named(self, output_filename): 
> -------------------------------------------------------------------- 
>
> (i.e., just add a gc.collect() to run_one_example) 
>
> and it causes a reliable failure in crypto/mq/mpolynomialsystem.py: 
>
> Trying: 
>     C[Integer(0)].groebner_basis()###line 84:_sage_    sage: 
> C[0].groebner_basis() 
> Expecting: 
>     Polynomial Sequence with 26 Polynomials in 16 Variables 
> testing example <ncadoctest.Example instance at 0x69706c8> 
> ok 
> Trying: 
>     A,v = mq.MPolynomialSystem(r2).coefficient_matrix()###line 
> 87:_sage_    sage: A,v = mq.MPolynomialSystem(r2).coefficient_matrix() 
> Expecting nothing 
> testing example <ncadoctest.Example instance at 0x6970710> 
> *** glibc detected *** python: double free or corruption (out): 
> 0x00000000075c58c0 *** 
> ======= Backtrace: ========= 
> /lib64/libc.so.6[0x31cfe7da76] 
> /lib64/libc.so.6[0x31cfe7ed5e] 
> /usr/local/sage/5.5b2/local/lib/python/site-packages/sage/rings/ 
> polynomial/pbori.so(+0x880aa)[0x7fa5eba7e0aa] 
> /usr/local/sage/5.5b2/local/lib/python/site-packages/sage/rings/ 
> polynomial/pbori.so(+0x1d993)[0x7fa5eba13993] 
> ... 
>
> Running it under sage -t --gdb gives: 
>
> (gdb) bt 
> #0  0x00000031cfe36285 in raise () from /lib64/libc.so.6 
> #1  0x00000031cfe37b9b in abort () from /lib64/libc.so.6 
> #2  0x00000031cfe7774e in __libc_message () from /lib64/libc.so.6 
> #3  0x00000031cfe7da76 in malloc_printerr () from /lib64/libc.so.6 
> #4  0x00000031cfe7ed5e in _int_free () from /lib64/libc.so.6 
> #5  0x00007fffce5cb0aa in 
> Delete<polybori::groebner::ReductionStrategy> (mem=0x547db30) 
>     at /usr/local/sage/5.5b2/local/include/csage/ccobject.h:77 
> #6 
> __pyx_pf_4sage_5rings_10polynomial_5pbori_17ReductionStrategy_2__dealloc__ 
> (__pyx_v_self=<optimized out>) 
>     at sage/rings/polynomial/pbori.cpp:37868 
> #7 
> __pyx_pw_4sage_5rings_10polynomial_5pbori_17ReductionStrategy_3__dealloc__ 
> (__pyx_v_self=0x54bf390) 
>     at sage/rings/polynomial/pbori.cpp:37834 
> #8 
> __pyx_tp_dealloc_4sage_5rings_10polynomial_5pbori_ReductionStrategy 
> (o=0x54bf390) at sage/rings/polynomial/pbori.cpp:52283 
> #9  0x00007fffce560993 in 
> __pyx_tp_clear_4sage_5rings_10polynomial_5pbori_GroebnerStrategy 
> (o=0x54baeb0) 
>     at sage/rings/polynomial/pbori.cpp:52545 
> #10 0x00007ffff7d4b637 in delete_garbage (old=0x7ffff7fe19e0, 
> collectable=0x7fffffffbb60) at Modules/gcmodule.c:769 
> #11 collect (generation=2) at Modules/gcmodule.c:930 
> #12 0x00007ffff7d4bdc9 in gc_collect (self=<optimized out>, 
> args=<optimized out>, kws=<optimized out>) at Modules/gcmodule.c:1067 
>
> which should give a pretty good pointer for pbori people to figure out 
> which memory deallocation is actually botched. 
>
We dealt with something very similar in one of the "memleaks" tickets.
Not sure it was 715 or 11521, but maybe 12313 (the figures here might be 
wrong...).
So the fix is potentially not included in 5.5.beta2 if it was in the later.
 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.


Reply via email to