durusmail: durus-users: About dangling references
About dangling references
2005-12-16
Jesus Cea
2005-12-16
David Binger
About dangling references
Jesus Cea
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Just checking how Durus behaves under "hostile" usage, I got this
(previsible) effect. Probably already known:

>>> from durus.persistent_dict import PersistentDict
>>> w=PersistentDict()
>>> root[0]=w
>>> connection.commit()
>>> del root[0]
>>> connection.commit()
.... Now we do a packing in other session ...
>>> root[0]=w
>>> connection.commit()

Now "root" has a dangling point to an inexistent object:

(opening a new session)
>>> root[0]

>>> root[0].items()
Traceback (most recent call last):
  File "", line 1, in ?
  File "/tmp/z/Durus-3.1/build/lib.linux-i686-2.4/durus/persistent.py",
line 124, in _p_load_state
    self._p_connection.load_state(self)
  File "/tmp/z/Durus-3.1/build/lib.linux-i686-2.4/durus/connection.py",
line 151, in load_state
    raise ReadConflictError([oid])
ReadConflictError: oids=[1]

I suggest to add to docs that we shouldn't keep references to objects
between transactions. We must refetch (perhaps from Durus internal
cache) objects when we start a new transaction.

Probably known already, sorry to bother you, but I didn't find any
reference in current docs.

I was checking this out in order to validate my design for the
BerkeleyDB backend, since it could erase the object without needing the
pack, so the effect would be far more severe.

- --
Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
jcea@argo.es http://www.argo.es/~jcea/ _/_/    _/_/  _/_/    _/_/  _/_/
                                      _/_/    _/_/          _/_/_/_/_/
PGP Key Available at KeyServ   _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBQ6JNWplgi5GaxT1NAQJ0EQP/RhzLk1CbmI3Dd4tXN3GVKVpkLoOcPM0d
PLdb5Mvy9ffMaLvspj1inyN6CDDz2HNLHC0FjuPzCHfFYX+P9tMJzmVWh37vZ3pf
Y8bSM2SNPF3x+fIQA0TWHQ7xGjQj2KyCDWKIj7PA6gaBuYlV4tBEB+SR+4MO7sms
L05yem8hqGQ=
=7FS0
-----END PGP SIGNATURE-----
reply