[ZODB-Dev] Invalidating caches for module refresh doesn't seem to work

Jim Fulton jim at zope.com
Tue Jan 30 10:55:40 EST 2007


On Jan 29, 2007, at 5:46 PM, Philipp von Weitershausen wrote:

> After refreshing a product, Zope 2 uses the following stanza in  
> App.RefreshFuncs.autoRefresh() to let the ZODB know that it should  
> invalidate its pickle caches:
>
>         ... refresh products
>         from ZODB import Connection
>         Connection.resetCaches()
>         transaction.commit()
>         jar._resetCache()
>         transaction.begin()

That is really weird code.  It looks very brittle.

> That way, persistent objects will use the newly reimported classes  
> instead of continuing to use the old, no longer current classes.

I suppose that was the intent.

> For grok I tried to implement the same mechanism and copied that  
> code almost verbatimly, only to find out it doesn't seem to work.  
> Persistent objects will still be instances of the classes that  
> should have been thrown away during the re-import of modules.

> Testing product refresh with both Zope 2.9 and 2.10 produces errors  
> for me while Zope 2.8 works, which leads me to the assumption that  
> a cache invalidation bug was introduced after ZODB 3.4. Is anybody  
> else seeing this?

The way that connections were managed changes quite a bit in 3.4.

> I'm a bit surprised nobody else has complained about this so far...

Maybe people finally stopped using product-refresh because it doesn't  
work
reliably.

> Help with tracking this down would be greatly appreciated.

Shane originally wrote this.  Maybe he could help out. I'm not  
interested myself. In fact, I'l be happy to see this code get  ripped  
out.  If it stays in it needs a doctest to prevent future regression  
and to explain how to use it, including what it's semantics and  
limitations are.

Jim

--
Jim Fulton			mailto:jim at zope.com		Python Powered!
CTO 				(540) 361-1714			http://www.python.org
Zope Corporation	http://www.zope.com		http://www.zope.org





More information about the ZODB-Dev mailing list