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
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='https://github.com/serhiy-storchaka'closed_at=<Date2013-01-25.11:36:17.711>created_at=<Date2011-11-22.16:10:44.540>labels= ['extension-modules', 'type-crash']
title='crash when deleting one pair from tee()'updated_at=<Date2013-01-26.09:56:33.793>user='https://bugs.python.org/PyryP'
tee() uses a linked-list of teedataobject. This list is destroyed by recursive calls to teedataobject_dealloc().
Extract of the gdb trace:
#5 0x08171a8e in teedataobject_clear (tdo=0xad21b394) at ./Modules/itertoolsmodule.c:412 #6 0x08171b39 in teedataobject_dealloc (tdo=0xad21b394) at ./Modules/itertoolsmodule.c:421 #7 0x0805ed3d in _Py_Dealloc (op=<itertools.tee_dataobject at remote 0xad21b394>) at Objects/object.c:1676 #8 0x08171b16 in teedataobject_clear (tdo=0xad21b274) at ./Modules/itertoolsmodule.c:413 #9 0x08171b39 in teedataobject_dealloc (tdo=0xad21b274) at ./Modules/itertoolsmodule.c:421 #10 0x0805ed3d in _Py_Dealloc (op=<itertools.tee_dataobject at remote 0xad21b274>) at Objects/object.c:1676 #11 0x08171b16 in teedataobject_clear (tdo=0xad21b154) at ./Modules/itertoolsmodule.c:413 #12 0x08171b39 in teedataobject_dealloc (tdo=0xad21b154) at ./Modules/itertoolsmodule.c:421 #13 0x0805ed3d in _Py_Dealloc (op=<itertools.tee_dataobject at remote 0xad21b154>) at Objects/object.c:1676 #14 0x08171b16 in teedataobject_clear (tdo=0xad21b034) at ./Modules/itertoolsmodule.c:413 #15 0x08171b39 in teedataobject_dealloc (tdo=0xad21b034) at ./Modules/itertoolsmodule.c:421 #16 0x0805ed3d in _Py_Dealloc (op=<itertools.tee_dataobject at remote 0xad21b034>) at Objects/object.c:1676 #17 0x08171b16 in teedataobject_clear (tdo=0xad292ed4) at ./Modules/itertoolsmodule.c:413 #18 0x08171b39 in teedataobject_dealloc (tdo=0xad292ed4) at ./Modules/itertoolsmodule.c:421 #19 0x0805ed3d in _Py_Dealloc (op=<itertools.tee_dataobject at remote 0xad292ed4>) at Objects/object.c:1676 #20 0x08171b16 in teedataobject_clear (tdo=0xad292db4) at ./Modules/itertoolsmodule.c:413 #21 0x08171b39 in teedataobject_dealloc (tdo=0xad292db4) at ./Modules/itertoolsmodule.c:421 #22 0x0805ed3d in _Py_Dealloc (op=<itertools.tee_dataobject at remote 0xad292db4>) at Objects/object.c:1676 #23 0x08171b16 in teedataobject_clear (tdo=0xad292c94) at ./Modules/itertoolsmodule.c:413
Activity
PyryP commentedon Nov 22, 2011
Running the following results in a Segmentation fault on Ubuntu 11.10 64-bit with both python and python3.
vstinner commentedon Nov 22, 2011
tee() uses a linked-list of teedataobject. This list is destroyed by recursive calls to teedataobject_dealloc().
Extract of the gdb trace:
#5 0x08171a8e in teedataobject_clear (tdo=0xad21b394) at ./Modules/itertoolsmodule.c:412
#6 0x08171b39 in teedataobject_dealloc (tdo=0xad21b394) at ./Modules/itertoolsmodule.c:421
#7 0x0805ed3d in _Py_Dealloc (op=<itertools.tee_dataobject at remote 0xad21b394>) at Objects/object.c:1676
#8 0x08171b16 in teedataobject_clear (tdo=0xad21b274) at ./Modules/itertoolsmodule.c:413
#9 0x08171b39 in teedataobject_dealloc (tdo=0xad21b274) at ./Modules/itertoolsmodule.c:421
#10 0x0805ed3d in _Py_Dealloc (op=<itertools.tee_dataobject at remote 0xad21b274>) at Objects/object.c:1676
#11 0x08171b16 in teedataobject_clear (tdo=0xad21b154) at ./Modules/itertoolsmodule.c:413
#12 0x08171b39 in teedataobject_dealloc (tdo=0xad21b154) at ./Modules/itertoolsmodule.c:421
#13 0x0805ed3d in _Py_Dealloc (op=<itertools.tee_dataobject at remote 0xad21b154>) at Objects/object.c:1676
#14 0x08171b16 in teedataobject_clear (tdo=0xad21b034) at ./Modules/itertoolsmodule.c:413
#15 0x08171b39 in teedataobject_dealloc (tdo=0xad21b034) at ./Modules/itertoolsmodule.c:421
#16 0x0805ed3d in _Py_Dealloc (op=<itertools.tee_dataobject at remote 0xad21b034>) at Objects/object.c:1676
#17 0x08171b16 in teedataobject_clear (tdo=0xad292ed4) at ./Modules/itertoolsmodule.c:413
#18 0x08171b39 in teedataobject_dealloc (tdo=0xad292ed4) at ./Modules/itertoolsmodule.c:421
#19 0x0805ed3d in _Py_Dealloc (op=<itertools.tee_dataobject at remote 0xad292ed4>) at Objects/object.c:1676
#20 0x08171b16 in teedataobject_clear (tdo=0xad292db4) at ./Modules/itertoolsmodule.c:413
#21 0x08171b39 in teedataobject_dealloc (tdo=0xad292db4) at ./Modules/itertoolsmodule.c:421
#22 0x0805ed3d in _Py_Dealloc (op=<itertools.tee_dataobject at remote 0xad292db4>) at Objects/object.c:1676
#23 0x08171b16 in teedataobject_clear (tdo=0xad292c94) at ./Modules/itertoolsmodule.c:413
ezio-melotti commentedon Nov 22, 2011
Confirmed on py3k, it doesn't seem to happen with smaller values.
amauryfa commentedon Nov 22, 2011
Also, a check for NULL would not hurt in tee_next():
serhiy-storchaka commentedon Oct 14, 2012
Here is a patch (tests included). Thank Pyry for report, Victor and Amaury for analysis.
Maybe I picked up the poor names for iterators? May be exhausted and unexhausted would be better? Feel free to correct me.
pitrou commentedon Oct 14, 2012
Serhiy, I only see a test in your patch, no actual modification to itertools.
serhiy-storchaka commentedon Oct 14, 2012
Oh, I worked on it in a different directory. Fortunately I found a temporary copy and I do not have to write all code again. Sorry.
serhiy-storchaka commentedon Nov 1, 2012
Please review.
serhiy-storchaka commentedon Dec 27, 2012
Ping.
birkenfeld commentedon Dec 28, 2012
The patch replaces a
which is what leads to the issues that Py_CLEAR is supposed to prevent. Therefore I think this patch is not correct.
serhiy-storchaka commentedon Dec 28, 2012
Good point. Here is updated patch.
serhiy-storchaka commentedon Jan 9, 2013
If no one objects I will commit this next week.
python-dev commentedon Jan 25, 2013
New changeset f7e14a1af609 by Serhiy Storchaka in branch '3.2':
Issue bpo-13454: Fix a crash when deleting an iterator created by itertools.tee()
http://hg.python.org/cpython/rev/f7e14a1af609
New changeset eff2a7346243 by Serhiy Storchaka in branch '3.3':
Issue bpo-13454: Fix a crash when deleting an iterator created by itertools.tee()
http://hg.python.org/cpython/rev/eff2a7346243
New changeset 02d7a127fdfb by Serhiy Storchaka in branch 'default':
Issue bpo-13454: Fix a crash when deleting an iterator created by itertools.tee()
http://hg.python.org/cpython/rev/02d7a127fdfb
New changeset 62f2d3f6015e by Serhiy Storchaka in branch '2.7':
Issue bpo-13454: Fix a crash when deleting an iterator created by itertools.tee()
http://hg.python.org/cpython/rev/62f2d3f6015e
python-dev commentedon Jan 26, 2013
New changeset 4ee8d38398d4 by Serhiy Storchaka in branch '2.7':
Optimize the test for issue bpo-13454.
http://hg.python.org/cpython/rev/4ee8d38398d4
New changeset d391b2849a51 by Serhiy Storchaka in branch '3.2':
Optimize the test for issue bpo-13454.
http://hg.python.org/cpython/rev/d391b2849a51
New changeset 2258b4d89c9f by Serhiy Storchaka in branch '3.3':
Optimize the test for issue bpo-13454.
http://hg.python.org/cpython/rev/2258b4d89c9f
New changeset 1f57fb5e1e8e by Serhiy Storchaka in branch 'default':
Optimize the test for issue bpo-13454.
http://hg.python.org/cpython/rev/1f57fb5e1e8e