While updating a load of DataSkins all together using a ZCatalog, I got this error: ---- 2000-09-03T08:03:13 PANIC(300) ZODB A storage error occurred in the last phase of a two-phase commit. This shouldn't happen. The application may be in a hosed state, so transactions will not be allowed to commit until the site/storage is reset by a restart. Traceback (innermost last): File lib/python/ZODB/Transaction.py, line 296, in commit File lib/python/Products/ZPatterns/Transactions.py, line 108, in tpc_finish File lib/python/Products/ZPatterns/Transactions.py, line 137, in end_tran File lib/python/Products/ZPatterns/Transactions.py, line 48, in _unregister (Object: ProviderContainer) KeyError: _v_registered ---- The line from Transactions.py in question is: def _unregister(self): del self._v_registered
From a little bit of instrumentation, I see that one of my Customizer instances is getting unregistered twice in a row.
An obvious naive fix is to put the del line in a try-except block, or to change it to if self._v_registered: del self._v_registered
From a lot of instrumenting code, tinkering and reading up on the ZODB transaction system, I think I've found what the problem is.
The error happens when the ZCatalog attempts to commit a subtransaction.
ZPatterns 0.4.2a1 PlugIns.py bug? I get a 'Name Error' aq_base when I hit the following code while trying to update the index_html method of one of my Specialists from CVSMixin.. I think that this would get hit anytime you add an object whose id is already in the acquisition path.... -steve diff -c -r1.1.1.2 PlugIns.py *** PlugIns.py 2000/09/04 14:17:29 1.1.1.2 --- PlugIns.py 2000/09/04 18:53:17 *************** *** 265,271 **** # An object by the given id exists either in this # ObjectManager or in the acquisition path. flags = getattr(obj, '__replaceable__', NOT_REPLACEABLE) ! if hasattr(aq_base(self), id): # The object is located in this ObjectManager. if not flags & REPLACEABLE: raise 'Bad Request', ('The id "%s" is invalid - ' \ --- 265,271 ---- # An object by the given id exists either in this # ObjectManager or in the acquisition path. flags = getattr(obj, '__replaceable__', NOT_REPLACEABLE) ! if hasattr(self.aq_base, id): # The object is located in this ObjectManager. if not flags & REPLACEABLE: raise 'Bad Request', ('The id "%s" is invalid - ' \
OK I think I found the actual intent of aq_base() in _checkId of PlugIns.py: if hasattr(aq_base(self), id): # The object is located in this ObjectManager. if not flags & REPLACEABLE: raise 'Bad Request', ('The id "%s" is invalid - ' \ 'it is already in use.' % id) # else the object is replaceable even if the UNIQUE # flag is set. elif flags & UNIQUE: raise 'Bad Request', \ ('The id "%s" is reserved.' % id) it comes from the ObjectManager _checkId which has basically the same code execpt it ObjectManager.py also has the needed: from Acquisition import aq_base which PlugIns.py does not.. so looking at Acquisition.c it appears that there is no real difference between hasattr(aq_base(self), id) which calls if (WRAPPER(self)->obj) { r=WRAPPER(self)->obj; while (isWrapper(r) && WRAPPER(r)->obj) r=WRAPPER(r)->obj; } else r=Py_None; Py_INCREF(r); return r; and hasattr( self.aq_base, id) which calls case 'b': if (strcmp(name,"base")==0) { if (self->obj) { r=self->obj; while (isWrapper(r) && WRAPPER(r)->obj) r=WRAPPER(r)->obj; } else r=Py_None; Py_INCREF(r); return r; } break; Anyway.. it looks like either fix is OK... I guess! -steve
"Steve" == Steve Spicklemire <steve@spvi.com> writes:
Steve> ZPatterns 0.4.2a1 PlugIns.py bug? Steve> I get a 'Name Error' aq_base when I hit the following code Steve> while trying to update the index_html method of one of my Steve> Specialists from CVSMixin.. I think that this would get hit Steve> anytime you add an object whose id is already in the Steve> acquisition path.... Steve> -steve Steve> diff -c -r1.1.1.2 PlugIns.py *** PlugIns.py 2000/09/04 Steve> 14:17:29 1.1.1.2 --- PlugIns.py 2000/09/04 18:53:17 Steve> *************** *** 265,271 **** # An object by the given Steve> id exists either in this # ObjectManager or in the Steve> acquisition path. flags = getattr(obj, '__replaceable__', Steve> NOT_REPLACEABLE) ! if hasattr(aq_base(self), id): # The Steve> object is located in this ObjectManager. if not flags & Steve> REPLACEABLE: raise 'Bad Request', ('The id "%s" is invalid Steve> - ' \ --- 265,271 ---- # An object by the given id exists Steve> either in this # ObjectManager or in the acquisition path. Steve> flags = getattr(obj, '__replaceable__', NOT_REPLACEABLE) ! Steve> if hasattr(self.aq_base, id): # The object is located in Steve> this ObjectManager. if not flags & REPLACEABLE: raise 'Bad Steve> Request', ('The id "%s" is invalid - ' \ Steve> _______________________________________________ Zope-Dev Steve> maillist - Zope-Dev@zope.org Steve> http://lists.zope.org/mailman/listinfo/zope-dev ** No cross Steve> posts or HTML encoding! ** (Related lists - Steve> http://lists.zope.org/mailman/listinfo/zope-announce Steve> http://lists.zope.org/mailman/listinfo/zope )
At 08:46 AM 9/5/00 -0500, Steve Spicklemire wrote:
OK I think I found the actual intent of aq_base() in _checkId of PlugIns.py: ... it comes from the ObjectManager _checkId which has basically the same code execpt it ObjectManager.py also has the needed:
from Acquisition import aq_base
Fixed in my CVS. Thanks!
participants (3)
-
Phillip J. Eby -
Steve Alexander -
Steve Spicklemire