classification
Title: dict reentrant/threading request
Type: enhancement Stage: test needed
Components: Interpreter Core Versions: Python 3.2
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: BreamoreBoy, Rhamphoryncus, gregory.p.smith
Priority: normal Keywords:

Created on 2007-06-13 22:32 by Rhamphoryncus, last changed 2010-09-17 22:36 by Rhamphoryncus.

Messages (3)
msg32322 - (view) Author: Adam Olsen (Rhamphoryncus) Date: 2007-06-13 22:32
As I first mentioned in my post[1] on comp.lang.python, it seems possible to modify a dict while a lookup is ongoing, without causing the lookup to restart.  This requires the ma_table be reallocated twice (first to a new address, then a second time back to the original address).  This could also happen if the constants or behaviour relating to ma_smalltable were changed, but the current implementation is safe.

To fix this, I suggest two more tests be added along side the ep0 and startkey tests that currently restart the lookup process.

1) ma_mask.  If ma_table was reallocated, and the new allocation is smaller, memory corruption would result.  Checking ma_mask for changes would ensure this doesn't happen.

2) reallocation counter.  Increment every time ma_table is reallocated.  It would be technically possible to overflow this, but the circumstances would be exceedingly unusual.


[1] http://groups.google.com/group/comp.lang.python/browse_thread/thread/7f5b8fc59aadbdea/d77bdbcf5b20c056
msg116691 - (view) Author: Mark Lawrence (BreamoreBoy) Date: 2010-09-17 17:35
Is this something that should be taken up on python-dev?
msg116728 - (view) Author: Adam Olsen (Rhamphoryncus) Date: 2010-09-17 22:36
I don't believe there's anything to debate on this, so all it really needs is a patch, followed by getting someone to review and commit it.
History
Date User Action Args
2010-09-17 22:36:33Rhamphoryncussetmessages: + msg116728
2010-09-17 17:35:51BreamoreBoysetnosy: + BreamoreBoy
messages: + msg116691
2010-07-10 11:53:26BreamoreBoysettitle: dict reentrant/threading bug -> dict reentrant/threading request
versions: - Python 2.7
2009-05-15 02:08:42ajaksu2setstage: test needed
versions: + Python 2.7, Python 3.2, - Python 2.6, Python 3.0
2008-01-17 01:35:08gregory.p.smithsetnosy: + gregory.p.smith
2008-01-06 12:33:29christian.heimessettype: enhancement
components: + Interpreter Core, - None
versions: + Python 2.6, Python 3.0
2007-06-13 22:32:25Rhamphoryncuscreate