Core dump with increased recursionlimit

Nick Craig-Wood nick at craig-wood.com
Tue Oct 12 19:30:11 CEST 2004


<exarkun at divmod.com> wrote:
>  On 12 Oct 2004 09:29:58 GMT, Nick Craig-Wood <nick at craig-wood.com> wrote:
> >I've just discovered that my python (Python 2.3.4 from debian package
> > 2.3.4-1 running on debian testing x86 + linux 2.4.26) core dumps when
> > I set recursionlimit very high and do lots of recursion.
> 
>  You probably have a buggy version of glibc.  There is a version
>  which automatically sets the stack limit to a fairly small value (I
>  forget what the limit is exactly, 2 MB perhaps).  If this is the
>  case and you strace your program, you will see a setrlimit() call
>  near the beginning of the run.

Spot on!

...
getrlimit(RLIMIT_STACK, {rlim_cur=RLIM_INFINITY, rlim_max=RLIM_INFINITY}) = 0
setrlimit(RLIMIT_STACK, {rlim_cur=2044*1024, rlim_max=RLIM_INFINITY}) = 0
...

So its 1 page less than 2 MB.

Reading a bit more - this didn't affect my test C program because it
didn't use pthreads.

  http://sources.redhat.com/ml/bug-glibc/2003-06/msg00190.html

I'll look out for a glibc upgrade!

Thanks
-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list