ZODB cross-database savepoints forget explicit connection adds

Bug #251214 reported by Fred Drake
2
Affects Status Importance Assigned to Milestone
ZODB
Incomplete
Undecided
Unassigned

Bug Description

It's possible for an object's association with a connection during the course of a transaction can be forgotten during a savepoint.

Here's one way to trigger this (may be oversimplified):

1. Add an object to a specific connection.

2. Call transaction.savepoint().

3. Add a reference to the object from an object associated with another connection.

4. Call transaction.savepoint().

An exception gets generated at this point:

InvalidObjectReference: A new object is reachable from multiple databases. Won't try to guess which one was correct!

(Raised by ZODB.serialize.ObjectWriter.persistent_id() after checking obj._p_jar._implicitlyAdded().)

Revision history for this message
Jim Fulton (jim-zope) wrote : Re: [Bug 251214] [NEW] ZODB cross-database savepoints forget explicit connection adds

On Jul 23, 2008, at 1:16 PM, Fred Drake wrote:

> Public bug reported:
>
> It's possible for an object's association with a connection during the
> course of a transaction can be forgotten during a savepoint.

The problem is that Connection._implicitlyAdding considers something
to be implicitly added if it was added in a savepoint -- even if it
was explicitly added to the savepoint.

Jim

--
Jim Fulton
Zope Corporation

Tres Seaver (tseaver)
affects: zope3 → zodb
Revision history for this message
Jim Fulton (jim-zope) wrote :

I can't reproduce this. I tried:

>>> db = ZODB.DB(None)
>>> db2 = ZODB.DB(None, database_name='2', databases=db.databases)
>>> c = db.open()
>>> o = c.root().__class__()
>>> c.add(o)
>>> transaction.savepoint()
>>> c.get_connection('2').root.o = o
>>> transaction.savepoint()

and didn't get any errors. Is this still a problem? If so, may I have a test case?

Changed in zodb:
status: New → Incomplete
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.