You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Problem with recursion in dict (crash with core dump) #41979
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2005-05-23.04:46:32.000>created_at=<Date2005-05-13.15:43:19.000>labels= ['interpreter-core']
title='Problem with recursion in dict (crash with core dump)'updated_at=<Date2005-05-23.04:46:32.000>user='https://bugs.python.org/vys'
This is output from `uname -a`:
FreeBSD fox.renet.ru 5.3-RELEASE FreeBSD 5.3-RELEASE
#1: Fri Apr 15 10:38:49 MSD 2005
root@fox.renet.ru:/M/safedir/src/sys/i386/compile/FOX i386
I get some others with this code:
Python 2.4.1 (#2, Apr 26 2005, 14:16:31)
[GCC 3.4.2 [FreeBSD] 20040728] on freebsd5
Type "help", "copyright", "credits" or "license" for more
information.
>>> d = {}
>>>
>>> classtest:
... def__hash__(self):
... d[self] =None
...
>>> d[test()] =None
Bus error (core dumped)
fox:vys!~ > gdb python python.core
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public
License, and you are
welcome to change it and/or distribute copies of it under
certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show
warranty" for details.
This GDB was configured as "i386-marcel-freebsd"...(no
debugging symbols found)...
Core was generated by `python'.
Program terminated with signal 10, Bus error.
<skip>
(gdb) where
#0 0x2828b3b1 in ldexp () from /lib/libc.so.5
#1 0x2828b618 in malloc () from /lib/libc.so.5
#2 0x080bdca1 in _PyObject_GC_Malloc ()
#3 0x080bdd4a in _PyObject_GC_New ()
#4 0x0805f556 in PyMethod_New ()
#5 0x0805c1a6 in PyInstance_NewRaw ()
#6 0x0805c66a in PyInstance_New ()
#7 0x0805cca1 in _PyInstance_Lookup ()
#8 0x080703e6 in PyDict_SetItem ()
#9 0x0809bb0e in PyEval_EvalFrame ()
#10 0x0809fc20 in PyEval_EvalCodeEx ()
#11 0x080d4d66 in PyFunction_SetClosure ()
#12 0x0805a38c in PyObject_Call ()
#13 0x0805fbe2 in PyMethod_New ()
#14 0x0805a38c in PyObject_Call ()
#15 0x08099f1b in PyEval_CallObjectWithKeywords ()
#16 0x0805ccb9 in _PyInstance_Lookup ()
#17 0x080703e6 in PyDict_SetItem ()
#18 0x0809bb0e in PyEval_EvalFrame ()
#19 0x0809fc20 in PyEval_EvalCodeEx ()
#20 0x080d4d66 in PyFunction_SetClosure ()
#21 0x0805a38c in PyObject_Call ()
#22 0x0805fbe2 in PyMethod_New ()
<and so on>
Does the buggy code generate the expected exception if you
use sys.setrecursionlimit() to make the value smaller (e.g.
500)?
FreeBSD has a history of not playing well with CPython's
ability to detect inifinite recursion. . .
vys commented on May 18, 2005
vysmannequin
MannequinAuthor
More actions
Logged In: YES
user_id=384980
sys.getrecursionlimit() returns 1000.
I set sys.setrecursionlimit() to 500 and problem was resolved :)
Thank you very much !
PS. Is it possible to add some checks in Py_SetRecursionLimit
to reject overflow values ?
josiahcarlson commented on May 23, 2005
josiahcarlsonmannequin
Mannequin
More actions
Logged In: YES
user_id=341410
If your system has sufficient stack space (and/or a
reasonably sane malloc), a recursion limit of 1000 should be
fine. My windows systems print tracebacks properly for up
to a recursion limit of around 5750 levels (after which I
get MemoryErrors with tracebacks, not cores).
Place a sys.setrecursionlimit() call in your site.py.
FWIW, the OP's original situation may have tickled a
genuine bug where one of the recursed into routines makes a
malloc request but fails to check for, report, or gracefully
exit from a memory error.
His gdb trace may show the way, but I didn't see the bug.
Activity
vys commentedon May 13, 2005
Please see example code.
mwhudson commentedon May 13, 2005
Logged In: YES
user_id=6656
I see no code. SF can be a pain with this...
vys commentedon May 13, 2005
Logged In: YES
user_id=384980
mwhudson commentedon May 13, 2005
Logged In: YES
user_id=6656
I get an infinite recursion runtime error. What platform
are you on?
rhettinger commentedon May 13, 2005
Logged In: YES
user_id=80475
I get the expected behavior:
RuntimeError: maximum recursion depth exceeded
vys commentedon May 13, 2005
Logged In: YES
user_id=384980
ncoghlan commentedon May 18, 2005
Logged In: YES
user_id=1038590
What does sys.getrecursionlimit() return?
Does the buggy code generate the expected exception if you
use sys.setrecursionlimit() to make the value smaller (e.g.
500)?
FreeBSD has a history of not playing well with CPython's
ability to detect inifinite recursion. . .
vys commentedon May 18, 2005
Logged In: YES
user_id=384980
sys.getrecursionlimit() returns 1000.
I set sys.setrecursionlimit() to 500 and problem was resolved :)
Thank you very much !
PS. Is it possible to add some checks in Py_SetRecursionLimit
to reject overflow values ?
josiahcarlson commentedon May 23, 2005
Logged In: YES
user_id=341410
If your system has sufficient stack space (and/or a
reasonably sane malloc), a recursion limit of 1000 should be
fine. My windows systems print tracebacks properly for up
to a recursion limit of around 5750 levels (after which I
get MemoryErrors with tracebacks, not cores).
Place a sys.setrecursionlimit() call in your site.py.
rhettinger commentedon May 23, 2005
Logged In: YES
user_id=80475
FWIW, the OP's original situation may have tickled a
genuine bug where one of the recursed into routines makes a
malloc request but fails to check for, report, or gracefully
exit from a memory error.
His gdb trace may show the way, but I didn't see the bug.