[Python-Dev] Core dump in garbage collection (I think)

Barry A. Warsaw bwarsaw@beopen.com
Mon, 10 Jul 2000 18:20:54 -0400 (EDT)


--ADeQU47/Is
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit


While running through the test suite with Purify, I ran across the
following script which core dumps the current CVS snapshot.  You need
to have gc enabled to trigger this.  I'm running on Solaris 2.6, using
gcc 2.8.1.  It also cores my Linux build of Python from CVS using
egcs-2.91.66.

-Barry


--ADeQU47/Is
Content-Type: text/plain
Content-Disposition: inline;
	filename="core.py"
Content-Transfer-Encoding: 7bit

import sre

assert sre.sub('.', lambda m: r"\n", 'x') == '\\n'
assert sre.sub('.', r"\n", 'x') == '\n'

s = r"\1\1"
assert sre.sub('(.)', s, 'x') == 'xx'
assert sre.sub('(.)', sre.escape(s), 'x') == s 
assert sre.sub('(.)', lambda m: s, 'x') == s

assert sre.sub('(?P<a>x)', '\g<a>\g<a>', 'xx') == 'xxxx'
assert sre.sub('(?P<a>x)', '\g<a>\g<1>', 'xx') == 'xxxx'
assert sre.sub('(?P<unk>x)', '\g<unk>\g<unk>', 'xx') == 'xxxx'
assert sre.sub('(?P<unk>x)', '\g<1>\g<1>', 'xx') == 'xxxx'

assert sre.sub('a', r'\t\n\v\r\f\a\b\B\Z\a\A\w\W\s\S\d\D', 'a') == '\t\n\v\r\f\a\b\\B\\Z\a\\A\\w\\W\\s\\S\\d\\D'
assert sre.sub('a', '\t\n\v\r\f\a', 'a') == '\t\n\v\r\f\a'
assert sre.sub('a', '\t\n\v\r\f\a', 'a') == (chr(9)+chr(10)+chr(11)+chr(13)+chr(12)+chr(7))

assert sre.sub('^\s*', 'X', 'test') == 'Xtest'

--ADeQU47/Is
Content-Type: text/plain; charset=us-ascii
Content-Description: message body text
Content-Transfer-Encoding: 7bit



-------------------- snip snip --------------------
Program received signal SIGSEGV, Segmentation fault.
0x18659c in gc_list_remove (node=0x48028c) at ./gcmodule.c:86
86              node->gc_prev->gc_next = node->gc_next;
(gdb) where
#0  0x18659c in gc_list_remove (node=0x48028c) at ./gcmodule.c:86
#1  0x186fb4 in visit_reachable (op=0x480298, roots=0xefffe648)
    at ./gcmodule.c:194
#2  0x1227b0 in list_traverse (o=0x494ae4, visit=0x186f08 <visit_reachable>, 
    arg=0xefffe648) at listobject.c:1339
#3  0x18710c in move_root_reachable (reachable=0xefffe648) at ./gcmodule.c:212
#4  0x187dc8 in collect (young=0x4026c0, old=0x4026cc) at ./gcmodule.c:390
#5  0x1883fc in collect_generations () at ./gcmodule.c:481
#6  0x1884e4 in _PyGC_Insert (op=0x4d48fc) at ./gcmodule.c:500
#7  0x147220 in PyTuple_New (size=1) at tupleobject.c:96
#8  0x148348 in tupleslice (a=0x4e40d4, ilow=1, ihigh=2) at tupleobject.c:294
#9  0xfbc80 in PySequence_GetSlice (s=0x4e40d4, i1=1, i2=2) at abstract.c:897
#10 0x8a100 in Exception__init__ (self=0x4d736c, args=0x4e40d4)
    at exceptions.c:217
#11 0xb0754 in call_builtin (func=0x445ce0, arg=0x4e40d4, kw=0x0)
    at ceval.c:2404
#12 0xb03fc in PyEval_CallObjectWithKeywords (func=0x445ce0, arg=0x4e40d4, 
    kw=0x0) at ceval.c:2369
#13 0xb0e9c in call_function (func=0x445ce0, arg=0x4e40d4, kw=0x0)
    at ceval.c:2484
#14 0xb03bc in PyEval_CallObjectWithKeywords (func=0x44ad34, arg=0x4e46bc, 
    kw=0x0) at ceval.c:2367
#15 0x101988 in PyInstance_New (class=0x44f8ec, arg=0x4e46bc, kw=0x0)
    at classobject.c:472
#16 0xb07b8 in call_builtin (func=0x44f8ec, arg=0x4e46bc, kw=0x0)
    at ceval.c:2407
#17 0xb03fc in PyEval_CallObjectWithKeywords (func=0x44f8ec, arg=0x4e46bc, 
    kw=0x0) at ceval.c:2369
#18 0xc6c30 in PyErr_NormalizeException (exc=0xefffedf8, val=0xefffedfc, 
    tb=0xefffee00) at errors.c:190
#19 0xaba18 in eval_code2 (co=0x4b5c08, globals=0x4a5b94, locals=0x0, 
    args=0x462a1c, argcount=2, kws=0x462a24, kwcount=0, defs=0x0, defcount=0, 
    owner=0x0) at ceval.c:1846
#20 0xa7f3c in eval_code2 (co=0x4b7eb0, globals=0x466824, locals=0x0, 
    args=0x4e4b78, argcount=4, kws=0x4e4b88, kwcount=0, defs=0x4dcec8, 
    defcount=1, owner=0x0) at ceval.c:1587
#21 0xa7f3c in eval_code2 (co=0x47d1f8, globals=0x466824, locals=0x0, 
    args=0x4bac00, argcount=4, kws=0x0, kwcount=0, defs=0x4dcd18, defcount=1, 
    owner=0x0) at ceval.c:1587
#22 0xb13c0 in call_function (func=0x4dcc2c, arg=0x4babf4, kw=0x0)
    at ceval.c:2529
#23 0xb03bc in PyEval_CallObjectWithKeywords (func=0x4dcc2c, arg=0x4babf4, 
    kw=0x0) at ceval.c:2367
#24 0xfe284 in PyObject_CallObject (o=0x4dcc2c, a=0x4babf4) at abstract.c:1360
#25 0x1c42f4 in call (function=0x2cdbe0 "_sub", args=0x4babf4) at ./_sre.c:1458
#26 0x1c4514 in pattern_sub (self=0x4ea2a0, args=0x4e605c) at ./_sre.c:1474
#27 0xb0754 in call_builtin (func=0x4d42b0, arg=0x4e605c, kw=0x0)
    at ceval.c:2404
#28 0xb03fc in PyEval_CallObjectWithKeywords (func=0x4d42b0, arg=0x4e605c, 
    kw=0x0) at ceval.c:2369
#29 0xa90f0 in eval_code2 (co=0x479378, globals=0x466824, locals=0x0, 
    args=0x45d600, argcount=3, kws=0x45d60c, kwcount=0, defs=0x48e598, 
    defcount=1, owner=0x0) at ceval.c:1688
#30 0xa7f3c in eval_code2 (co=0x47a6e8, globals=0x45b14c, locals=0x45b14c, 
    args=0x0, argcount=0, kws=0x0, kwcount=0, defs=0x0, defcount=0, owner=0x0)
    at ceval.c:1587
#31 0x8e71c in PyEval_EvalCode (co=0x47a6e8, globals=0x45b14c, locals=0x45b14c)
    at ceval.c:298
#32 0xe6f9c in run_node (n=0x4644f8, filename=0xeffffb26 "/tmp/core.py", 
    globals=0x45b14c, locals=0x45b14c) at pythonrun.c:895
#33 0xe6eac in run_err_node (n=0x4644f8, filename=0xeffffb26 "/tmp/core.py", 
    globals=0x45b14c, locals=0x45b14c) at pythonrun.c:880
#34 0xe6df0 in PyRun_File (fp=0x42e728, filename=0xeffffb26 "/tmp/core.py", 
    start=257, globals=0x45b14c, locals=0x45b14c) at pythonrun.c:868
#35 0xe5218 in PyRun_SimpleFile (fp=0x42e728, 
    filename=0xeffffb26 "/tmp/core.py") at pythonrun.c:578
#36 0xe4804 in PyRun_AnyFile (fp=0x42e728, filename=0xeffffb26 "/tmp/core.py")
    at pythonrun.c:459
#37 0x85584 in Py_Main (argc=3, argv=0xeffff9fc) at main.c:271
#38 0x84848 in main (argc=3, argv=0xeffff9fc) at python.c:10

--ADeQU47/Is--