[Zope] What is an InvalidObjectReference?

Dieter Maurer dieter at handshake.de
Thu Nov 9 15:15:29 EST 2006


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


More information about the Zope mailing list