[ZCM] [ZC] 2283/ 1 Request "AssertionError: BeforeCommitHook with commit()"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Fri Feb 23 17:26:42 EST 2007


Issue #2283 Update (Request) "AssertionError: BeforeCommitHook with commit()"
 Status Pending, Zope/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/2283

==============================================================
= Request - Entry #1 by eikenberry on Feb 23, 2007 5:26 pm

If you add a function via the addBeforeCommitHook() that contains a transaction.get().commit(). It causes the folling traceback (from 2.9.6).

Error Type: AssertionError
Error Value:
Traceback (innermost last):
    * Module ZPublisher.Publish, line 121, in publish
    * Module Zope2.App.startup, line 240, in commit
    * Module transaction._manager, line 96, in commit
    * Module transaction._transaction, line 384, in commit
    * Module transaction._manager, line 155, in free
AssertionError

This is due to the transaction's commit() being called twice which in turn calls the transaction manager's free() method twice causing the assertion error the second time for obvious reasons.

    def free(self, txn):
        tid = thread.get_ident()
        assert txn is self._txns.get(tid) 
        del self._txns[tid]



==============================================================



More information about the Zope-Collector-Monitor mailing list