On Fri, Jan 28, 2011 at 4:58 PM, Jürgen Herrmann
<juergen.herrm...@xlhost.de> wrote:
>  Afaics you use zodbpack's default of "days=0". This is known to produce
>  POSKeyErrors if the database is written to while packing.

It can lead to POSKeyErrors under certain pathological cases, but Is not
generally a problem in practice.

An example where it could be a problem:

    x = Foo()

At this point, x is in the database and is thus garbage.  For the sake
of this discussion, assume the database is packed to this point in
time and x is removed from the database.

    self.x = x

At this point, self refers to an object that is no longer in the
db. At some later time, once self has been ghostified and x is removed
from local cache, if we try to access x, we'll get a poskey error.

I would argue that the application code above is broken.

Note that the storage could validate the reference to x when self is
saved, but no storage that I know of does, for performance reasons.
In some future version of ZODB, it might be nice to change the
database record structure to make this sort of check easier.


Jim Fulton
For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to