#715: Parents probably not reclaimed due to too much caching
-------------------------------------------------------------------+--------
       Reporter:  robertwb                                         |         
Owner:  somebody                                 
           Type:  defect                                           |        
Status:  needs_review                             
       Priority:  major                                            |     
Milestone:  sage-5.4                                 
      Component:  coercion                                         |    
Resolution:                                           
       Keywords:  weak cache coercion Cernay2012                   |   Work 
issues:                                           
Report Upstream:  N/A                                              |     
Reviewers:  Jean-Pierre Flori, Simon King, Nils Bruin
        Authors:  Simon King, Jean-Pierre Flori                    |     Merged 
in:                                           
   Dependencies:  #9138, #11900, #11599, to be merged with #11521  |      
Stopgaps:                                           
-------------------------------------------------------------------+--------

Comment (by SimonKing):

 It seems to me that it is ''not'' a side effect. Namely, I put
 {{{
 class Foo:
     def bar(self):
         """
         Cache values for a number of inputs.  Do the computation
         in parallel, and only bother to compute values that we
         haven't already cached.

         EXAMPLES::

             sage: @cached_function
             ... def oddprime_factors(n):
             ...     l = [p for p,e in factor(n) if p != 2]
             ...     return len(l)
             sage: oddprime_factors.precompute(range(1,100), 4)
             sage: oddprime_factors.cache[(25,),()]
             1
         """
         pass
 }}}
 into a file and run `sage -t` on it. All tests pass -- '''__BUT__'''
 running `sage -t -gdb`, I get the same error as in cachefunc.pyx, where
 the test above is just one among many other tests:
 {{{
 Failed example:
     oddprime_factors.precompute(range(Integer(1),Integer(100)),
 Integer(4))###line 14:_sage_    >>>
 oddprime_factors.precompute(range(1,100), 4)
 Expected nothing
 Got:
     [Errno 4] Interrupted system call
     Killing any remaining workers...
 **********************************************************************
 File "/scratch/sking/sage-5.4.beta0/devel/sage-main/sage/misc/blubb.py",
 line ?, in __main__.example_0
 Failed example:
     oddprime_factors.cache[(Integer(25),),()]###line 15:_sage_    >>>
 oddprime_factors.cache[(25,),()]
 Exception raised:
     Traceback (most recent call last):
       File "/scratch/sking/sage-5.4.beta0/local/bin/ncadoctest.py", line
 1231, in run_one_test
         self.run_one_example(test, example, filename, compileflags)
       File "/scratch/sking/sage-5.4.beta0/local/bin/sagedoctest.py", line
 38, in run_one_example
         OrigDocTestRunner.run_one_example(self, test, example, filename,
 compileflags)
       File "/scratch/sking/sage-5.4.beta0/local/bin/ncadoctest.py", line
 1172, in run_one_example
         compileflags, 1) in test.globs
       File "<doctest __main__.example_0[4]>", line 1, in <module>
         oddprime_factors.cache[(Integer(25),),()]###line 15:_sage_    >>>
 oddprime_factors.cache[(25,),()]
     KeyError: ((25,), ())
 }}}
 The "Killing any remaining workers" comes from a parallel computation,
 isn't it? The `precompute()` method is parallel. Let us see whether it
 also fails in an interactive session under gdb!

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