[Zope-dev] What can cause an InvalidObjectReference?

kosh kosh@aesaeion.com
Fri, 24 Aug 2001 11:26:35 -0600


On Friday 24 August 2001 06:38 am, Chris McDonough wrote:
> This will happen if yoiu've got a mounted ZODB database, and you attemp=
t
> to store an object in the mounted database which has references to othe=
r
> objects in the "main" database (or vice versa).
>
> For more info, read the docs that ship with CoreSessionTracking.
>
> - C
>

Interesting to know but unfortunately it doesn't cover this situation as =
far=20
as I can tell. I have only one ZODB and the objects are stored directly i=
n=20
there. There are no other databases being used with it either (ie an SQL =
DB).=20
The objects are CatalogAware though and do catalog themselves in the cata=
log.=20
On the windows server this operation will cause the InvalidObjectReferenc=
e=20
nearly every time an object is created and much of the time when an objec=
t is=20
changed. To make matters worse on the unix boxes the items create and cat=
alog=20
themselves just fine most of the time. On them the error seems to occur a=
bout=20
once per week or so.

When I look in the Catalog though everything looks normal. It has a=20
PrincipiaSearchSource that has the keywords I would expect along with the=
=20
date it was changed etc. It is a default Catalog without any custom index=
es=20
etc added to it at this point. PrincipiaSearchSource for my object return=
s a=20
string of all the words it wants cataloged.

Thanks again

> kosh wrote:
> > When a product I have was stuck on a windows server this seems to hap=
pen
> > a lot. On the unix servers I have been running the product on normall=
y
> > this seems to happen about once/week under pretty heavy usage.
> >
> > This is the error message
> > Error Type: InvalidObjectReference
> > Error Value: Attempt to store an object from a foreign database
> > connection
> >
> > This is the traceback for it
> > Traceback (innermost last):
> >   File D:\ZOPE1\lib\python\ZPublisher\Publish.py, line 223, in
> > publish_module File D:\ZOPE1\lib\python\ZPublisher\Publish.py, line 1=
87,
> > in publish File D:\ZOPE1\lib\python\Zope\__init__.py, line 221, in
> > zpublisher_exception_hook
> >   File D:\ZOPE1\lib\python\ZPublisher\Publish.py, line 175, in publis=
h
> >   File D:\ZOPE1\lib\python\Zope\__init__.py, line 235, in commit
> >   File D:\ZOPE1\lib\python\ZODB\Transaction.py, line 300, in commit
> >   File D:\ZOPE1\lib\python\ZODB\Connection.py, line 375, in commit
> >     (Info: (('Products.CompoundDoc.inputtext', 'InputText'),
> > '\000\000\000\000\000\000-t', ''))
> > InvalidObjectReference: (see above)
> >
> > I am mostly wondering what kinds of things in my code could cause thi=
s
> > problem. Mostly I need a place to start to try and debug this.
> >
> > The "fix" I have normally used is that if I hit refresh the problem w=
ill
> > go away until it happens again. It just allows you to keep working wi=
th
> > it again until whatever it is that causes it causes it again. I hope =
that
> > helps some also.
> >
> > Thanks
> > Kosh