#12215: Memleak in UniqueRepresentation, @cached_method
-----------------------------+----------------------------------------------
   Reporter:  vbraun         |          Owner:  rlm                             
          
       Type:  defect         |         Status:  needs_work                      
          
   Priority:  major          |      Milestone:  sage-5.0                        
          
  Component:  memleak        |       Keywords:  UniqueRepresentation 
cached_method caching
Work_issues:  Fix two tests  |       Upstream:  N/A                             
          
   Reviewer:                 |         Author:  Simon King                      
          
     Merged:                 |   Dependencies:  #11115 #11900                   
          
-----------------------------+----------------------------------------------

Comment(by SimonKing):

 Here is some more info on the segfault.

 Setting: I have sage-5.0.prealpha0 plus #11780, #11290, #715, #11521,
 #12313 and the patches from here, removing the `__dealloc__` method
 introduced by the last patch.

 The segfault is triggered by doing
 {{{
 sage: half_integral_weight_modform_basis(DirichletGroup(16,QQ).1, 3, 10)
 []
 sage: half_integral_weight_modform_basis(DirichletGroup(16,QQ).1, 5, 10)
 
/home/simon/SAGE/sage-5.0.prealpha0/local/lib/libcsage.so(print_backtrace+0x31)[0x7fe047add9c6]
 
/home/simon/SAGE/sage-5.0.prealpha0/local/lib/libcsage.so(sigdie+0x14)[0x7fe047add9f8]
 
/home/simon/SAGE/sage-5.0.prealpha0/local/lib/libcsage.so(sage_signal_handler+0x20c)[0x7fe047add646]
 /lib64/libpthread.so.0(+0xfd00)[0x7fe04cd80d00]
 ...
 }}}
 When I revert the lines, that's to say, if I do
 {{{
 sage: half_integral_weight_modform_basis(DirichletGroup(16,QQ).1, 5, 10)
 [q - 2*q^3 - 2*q^5 + 4*q^7 - q^9 + O(q^10)]
 sage: half_integral_weight_modform_basis(DirichletGroup(16,QQ).1, 3, 10)
 []
 sage: quit
 Exiting Sage (CPU time 0m2.02s, Wall time 0m20.49s).

 **********************************************************************

 Oops, Sage crashed. We do our best to make it stable, but...

 A crash report was automatically generated with the following information:
   - A verbatim copy of the crash traceback.
   - A copy of your input history during this session.
   - Data on your current Sage configuration.

 It was left in the file named:
         '/home/simon/.sage/ipython/Sage_crash_report.txt'
 If you can email this file to the developers, the information in it will
 help
 them in understanding and correcting the problem.

 You can mail it to: sage-support at [email protected]
 with the subject 'Sage Crash Report'.

 If you want to do it now, the following command will work (under Unix):
 mail -s 'Sage Crash Report' [email protected] <
 /home/simon/.sage/ipython/Sage_crash_report.txt

 To ensure accurate tracking of this issue, please file a report about it
 at:
 http://trac.sagemath.org/sage_trac

 Press enter to exit:
 }}}

 I was tracing all python commands for the first variant of the segfault.
 The last few lines of the log are as follows:
 {{{
 sage.categories.pushout:__call__:2125         if self.p == other.p:
 sage.categories.pushout:__call__:2126             from sage.all import
 Infinity
 sage.categories.pushout:__call__:2127             if self.prec ==
 other.prec:
 sage.categories.pushout:__call__:2128                 extras =
 self.extras.copy()
 sage.categories.pushout:__call__:3102     except CoercionException:
 sage.categories.pushout:__call__:3104     except (TypeError, ValueError,
 AttributeError, NotImplementedError), ex:
 sage.categories.pushout:__call__:3108         raise CoercionException(ex)
 weakref:__call__:49             self = selfref()
 weakref:__call__:50             if self is not None:
 weakref:__call__:51                 del self.data[wr.key]
 sage.rings.power_series_ring:__call__:556         s = "Power Series Ring
 in %s over %s"%(self.variable_name(), self.base_ring())
 sage.rings.power_series_ring:__call__:557         if self.is_sparse():
 sage.rings.power_series_ring:__call__:562         return self.__is_sparse
 sage.rings.power_series_ring:__call__:559         return s
 }}}
 So, indeed it seems that the problem has something to do with weak
 references. There is an item of a weak value dictionary deleted right
 before segfaulting.

 To do: Find out what item of what dictionary is deleted, why it is
 deleted, and how deletion can be prevented.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12215#comment:68>
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.

Reply via email to