[ZODB-Dev] [Enhancement Proposal] Memory size limited Cache
Tim Peters
tim.peters at gmail.com
Mon Oct 9 13:38:51 EDT 2006
...
|Jim Fulton]
>> Or consider object activation and deactivation. If a ghost is
>> shared among multiple threads, then __setstate__ could
>> be called from separate threads.
[Dieter Maurer]
> But, why should this be a problem? They would install the same
> state.
__setstate__ implementations are normally never written to be
thread-safe, and can leave the state temporarily insane /during/
construction; IOW, they expect to run "atomically", as does virtually
all code that isn't deliberately & carefully written to be
thread-safe. This goes deep; here's an example:
http://mail.zope.org/pipermail/zodb-dev/2005-April/008747.html
I believe I identified one cause for catastrophic thread-race
problems here (sharing a Connection across multiple threads, or
for any other reason sharing an in-memory persistent object across
non-serialized threads), even when objects are never modified. It
doesn't look shallow to me.
...
More information about the ZODB-Dev
mailing list