On Friday, May 20, 2016 at 9:50:05 AM UTC-7, Samuel Lelievre wrote:
>
>
> Could you tell which two places you have in mind?
>

http://trac.sagemath.org/ticket/20624
http://trac.sagemath.org/ticket/10963#comment:242

In both cases, the "RuntimeError: Maximum recursion depth exceeded" was 
caught by a try/except of the type: There's no harm in trying this first. 
If it fails for any reason, we'll just try something else. (except that the 
first thing ended up, via very circuitous routes, coming back to the same 
piece of code.

The problem in python is that in such a case, an infinite recursion does 
*not* incur a huge or particularly noticeable penalty before failing -- 
exactly because the depth is so severely limited.

In both cases, the infinite recursions were only discovered because 
sometimes, a garbage collection would be triggered with an extremely filled 
python callstack. Then, when weakref callbacks get executed, the recursion 
depth exception might happen there. Of course, python can't actually raise 
exceptions inside the GC, so there's no choice for python but to *ignore* 
the exception. It does print the fact it's ignoring an exception on the 
stdout/stderr, though, and this is NOT prevented by the try/except.

Obviously, the first time we ran into this issue, it was misdiagnosed as 
probably a recursion in a weakref callback handler. As a result, we now 
have what I think are extremely robust weakref callback handlers in some of 
our weak dictionaries (for instance, better than Python's standard 
WeakValueDictionary).

Perhaps we should patch Python so that it has a flag to coredump on a 
recursion depth exception rather than raise a catchable exception and run 
the testsuite with that option every now and again.

Come to think of it, I think that flag already exists:

sys.setrecursionlimit(50000)

seems to have the desired effect (my guess it's deep enough to overflow the 
C call stack)

Is there an easy way to inject that setting in a `sage -t` run ? It would 
be good to find if there are any other undiagnosed masked infinite 
recursions in the sage doctests.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to