This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: attached script causes python segfault
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: Nosy List: fmitha, hyeshik.chang, tim.peters
Priority: normal Keywords:

Created on 2004-06-15 01:41 by fmitha, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
python_debug.tar.gz fmitha, 2004-06-15 01:57 script and instructions for reproducing bug
Messages (4)
msg21188 - (view) Author: Faheem Mitha (fmitha) Date: 2004-06-15 01:41
I have filed a detailed report at 
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=252517

This corresponds to Debian bug #252517

The python maintainer, Matthias Klose, can reproduce
this without any Debian patches. On the other hand, I
cannot reproduce it on either of the two RedHat
machines I tried. In any case, it seems possible this
is an upstream problem.

The operating system is Debian sarge on i386 (Athlon XP
1700). The version of python I am using 2.3.3, the
current Debian defaults. The relevant Debian packages are

ii  python2.3                  2.3.4-1
ii  python2.3-numarray         0.9-3

For convenience, I attach a tar.gz file
(python_debug.tar.gz) which contains enough information
to reproduce the problem. See the included README.
Please refer to the Debian bug report for more
information and comments.

Please also copy (if possible) the Debian bug report
with relevant info. You can do so by emailing/ccing
252517@bugs.debian.org.

Thanks.                                               
                  Faheem.
msg21189 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2004-06-15 01:48
Logged In: YES 
user_id=31435

There's no file attached.  Note that SourceForge requires 
that you check the "Check to Upload and Attach a File" box, 
it's not enough just to fill in the filepath name.
msg21190 - (view) Author: Hyeshik Chang (hyeshik.chang) * (Python committer) Date: 2004-06-15 02:13
Logged In: YES 
user_id=55188

It's just a stack overflow due to excessive recursion calls
of factorial().

Your code:
sys.setrecursionlimit(1000000)

This may very dangerous in CPython. Consider spanning
factorial() function to for-loops or using Stackless Python.
msg21191 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2004-06-15 02:34
Logged In: YES 
user_id=31435

Looking at the original Debian report, I agree with perky that 
the recursive factorial is most likely to blame.  Python sets 
the default recursion limit to a much smaller value, because it 
can't reliably detect overflow of the C stack.  If you boost it 
above its default, you indeed risk segfaults.  The docs for 
setrecursion limit warn about this, too.
History
Date User Action Args
2022-04-11 14:56:04adminsetgithub: 40399
2004-06-15 01:41:25fmithacreate