[Zope-dev] Zope Head (2.8) breaks "refresh"
Dieter Maurer
dieter at handshake.de
Sun Dec 7 08:15:14 EST 2003
Playing with Zope Head (as of 2003-12-04) revealed problems with
refresh.
I see varying behaviour refreshing "CMFCore":
* Refresh is not effective (objects continue the have the old
behavior)
* After a while, "commit" reports an exception
"ValueError: Cache values may only be in one cache."
http://localhost:10080/Portal/portal_types/Document/manage_editProperties
Traceback (innermost last):
Module ZPublisher.Publish, line 104, in publish
Module Zope.App.startup, line 223, in commit
Module ZODB.Transaction, line 254, in commit
Module ZODB.Transaction, line 233, in commit
Module ZODB.Transaction, line 352, in _commit_objects
Module ZODB.Connection, line 286, in commit
ValueError: Cache values may only be in one cache.
The following transscript shows strange reproducible behaviour
which is almost surely related to the above:
linux: bin/zopectl debug
Starting debugger (the name "app" is bound to the top-level Zope object)
>>> pt=getattr(app,'standard_template.pt')
>>> pr=app.unrestrictedTraverse('Control_Panel/Products/PageTemplates/manage_performRefresh')
>>> pt.getId()
'standard_template.pt'
>>> pr() ## refresh
>>> pt.getId() ## apparently not deactivated
'standard_template.pt'
>>> pt._p_deactivate()
>>> pt.getId() ## obviously a wrong result
'Zope'
>>> pt.aq_base.getId() ## may be explainable as "pt" is not refetched
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/home/dieter/ZH/ZopeHead/lib/python/ZODB/Connection.py", line 424, in setstate
self._reader.setGhostState(obj, p)
File "/home/dieter/ZH/ZopeHead/lib/python/ZODB/serialize.py", line 203, in setGhostState
obj.__setstate__(state)
File "/home/dieter/ZH/ZopeHead/lib/python/Products/PageTemplates/ZopePageTemplate.py", line 301, in __setstate__
ZopePageTemplate.inheritedAttribute('__setstate__')(self, state)
AttributeError: 'NoneType' object has no attribute 'inheritedAttribute'
>>> pt=getattr(app,'standard_template.pt') ## refetch
>>> pt.getId() ## still wrong
'Zope'
Looks as if "refresh" did not flush the ZODB cache, which still
delivers objects referencing the old classes.
I now know why the above code does not work as I expected:
The new refresh no longer uses "minimize" to flush the ZODB
caches but updates the "code_timestamp".
This causes the cache to be replaced by a new one when
the connection is opened for the next time.
ATT: replacing the cache without clearing it can lead to huge
memory leaks (everything in the old cache is leaked!).
I can not yet explain the original observations...
--
Dieter
More information about the Zope-Dev
mailing list