[Zope] What is an InvalidObjectReference?

Garth B. garthb at gmail.com
Thu Nov 9 16:29:27 EST 2006


Ok, I understand in theory what the problem is, I'm just not clear where in
code this could be happening.  I'm not consciously manipulating connections
and I guess Zope is taking care of those low-level connection details with
the ZODB for me.

Can I programmatically determine whether an object is already loaded/cached
by a different connection?
Would it help to try isolate this routine to a single connection?
*Can* I isolate this routine to a single connection?

You know, I'm starting to think that my fancy little recursion between
objects is what's royally screwing things up.  A lot of loading of objects
occurs here, possibly touching on the same objects between calls...

Any other pointers/hints are welcome!

Thank you Dieter and anyone else who can help out!

Garth

On 11/9/06, Dieter Maurer <dieter at handshake.de> wrote:
>
> Garth B. wrote at 2006-11-9 11:21 -0500:
> >I'm sporadically getting the following error thrown as a result of a
> routine
> >I've written.
> >
> >InvalidObjectReference: Attempt to store a reference to an object from a
> >separate connection to the same database or multidatabase.
>
> This is in indication that you have introduced a persistency bug:
>
>   It is very essential that you use a persistent object only
>   in the context of the ZODB connection that loaded this object.
>
>   Failing to fulfill this requirement can lead to several kinds
>   of difficult to understand errors. The one, you see above
>   is one such kind.
>
>   Apparently, you try to store a persistent object from a connection "C1"
>   as attribute of a persistent object from a different connection "C2".
>
>
> The bug is usually introduced by storing persistent objects outside
> of their connection cache -- e.g. on class level or in a module level
> cache.
>
>
>
> --
> Dieter
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20061109/5d55eb54/attachment.htm


More information about the Zope mailing list