[Python-Dev] Preventing recursion core dumps

Vladimir Marangozov Vladimir.Marangozov@inrialpes.fr
Fri, 11 Aug 2000 17:58:45 +0200 (CEST)


Guido van Rossum wrote:
> 
> We could set the maximum to 1000 and assume a "reasonable" stack size,
> but that doesn't make me feel comfortable either.

Nor me, but it's more comfortable than a core dump, and is the only
easy solution, solving most problems & probably breaking some code...
After all, a max of 1024 seems to be a good suggestion.

> 
> It would be good if there was a way to sense the remaining available
> stack, even if it wasn't portable.  Any Linux experts out there?

On a second thought, I think this would be a bad idea, even if
we manage to tweak the stack limits on most platforms. We would
loose determinism = loose control -- no good. A depth-first algorithm
may succeed on one machine, and fail on another.

I strongly prefer to know that I'm limited to 1024 recursions ("reasonable"
stack size assumptions included) and change my algorithm if it doesn't fly
with my structure, than stumble subsequently on the fact that my algorithm
works half the time.

Changing this now *may* break such scripts, and there doesn't seem
to be an immediate easy solution. But if I were to choose between
breaking some scripts and preventing core dumps, well...

-- 
       Vladimir MARANGOZOV          | Vladimir.Marangozov@inrialpes.fr
http://sirac.inrialpes.fr/~marangoz | tel:(+33-4)76615277 fax:76615252