Comment 1 for bug 435962

Revision history for this message
James Henstridge (jamesh) wrote : Re: remove through a Reference leaves obsolete objects in _alive

First of all, it isn't a bug that the object remains in _alive: Storm is supposed to revalidate such an object before returning it after a transaction boundary. As long as an object remains alive, it is valid for it to remain in store._alive.

Next, you'll find that t1a is the same object as t1a_new, and the same for t1b and t1b_new: the only thing the store.find() call is doing is making sure that the corresponding DB rows still exist, which is not relevant to this test case.

With that out of the way, the only difference between t2a and t2b is that t2b has been accessed through the T1.t2 reference. The Reference class caches the resulting object, but invalidates that cache when the local key changes.

Normally this would happen on the transaction boundary when the local key is invalidated (i.e. at the transaction boundary), but in this case the local key is the object's primary key. Since the primary key is left as is, the reference's cache never gets cleared, and the now-dead object is returned.

So the correct fix would be for Reference() to validate that the remote object still exists (probably via store._validate_alive) before returning the cached object.