[ZODB-Dev] Possible race-condition in ZODB.Connection

Daniel Kraft news at spotlite.de
Mon Nov 5 11:22:45 EST 2007


Hi,

maybe I didn't fully understand the code, but I think I found a possible
race-condition in new code between what zope 2.9 and zope 2.10 uses.

In get(), a _pre_cache was added to avoid some infinite loop. Now, when
two threads want to get the same oid, I think it's possible that at
least one ends up with a unfinished object:

Thread Task
1      oid is in no cache, so self._storage.load()
1      self._pre_cache[oid] = obj
2      oid is not in cache _cache, _added, but in _pre_cache.
2      gets the obj from _pre_cache before thread 1 inited it.
2      uses object, which isn't initialized with _p_jar and so on.

Maybe I didn't see the code that prevents this. Any opinions?


Daniel



More information about the ZODB-Dev mailing list