[Zope-Coders] Zope test results

Kapil Thangavelu k_vertigo@yahoo.com
Thu, 21 Mar 2002 22:40:54 -0800 (PST)


hi jeremey

yes, this error is from a test i recently added. here
is the full test from testTransactions.py, i've
modified it to insert the keyword args for generating
a method trace.


    def testExceptionInSubAbortSub(self):

        self.sub1._p_jar =
SubTransactionJar(errors='commit_sub',
                                            
tracing='sub1')

        self.sub1.modify(nojar=1)

        get_transaction().commit(1)

        self.nosub1.modify(tracing='nosub')

        self.sub2._p_jar =
SubTransactionJar(errors='abort_sub',
                                            
tracing='sub2')

        self.sub2.modify(nojar=1)

        get_transaction().commit(1)
        
        self.sub3.modify(tracing='sub3')

        try:
            get_transaction().commit()
        except TestTxnException: pass

        if self.sub3._p_jar.ccommit_sub == 1:
            assert self.sub3._p_jar.ctpc_abort == 1
        else:
            assert self.sub3._p_jar.cabort_sub == 1


the assertion error appears from the last assert.

what its trying to emulate/test

   failure conditions within a transaction. 4 objects
involved in a series of subtransactions. one object
will throw an error in commit_sub (sub1) and another
will throw an error in abort_sub (sub2). the
assertions are to check that the last object (sub3) to
register for the transaction gets either an abort_sub
or tpc_abort message based on whether it recieved a
commit_sub message or not.

whats happening
   
   below is a method trace from the test with tracing
on from my sandbox. (nosub denotes a non sub
transaction aware jar).

sub1 calling method tpc_begin
sub1 calling method commit
sub1 calling method tpc_finish
nosub calling method tpc_begin
sub2 calling method tpc_begin
sub2 calling method commit
nosub calling method tpc_finish
sub2 calling method tpc_finish
sub3 calling method tpc_begin
sub3 calling method commit
sub3 calling method tpc_finish
nosub calling method tpc_begin
nosub calling method commit
sub2 calling method commit_sub
sub1 calling method commit_sub
nosub calling method tpc_abort
sub1 calling method tpc_abort
sub2 calling method tpc_abort
sub3 calling method abort_sub  

why its failing intermittently.

  the transaction object stores jars in a dict based
on id(), which was rather confusing to me while
developing these tests, certain errors almost seemed
relativistic based on whether i was observing them or
not, till i realized it was based on id. which is why
i added in the conditional test at the end. 

  the sub3 is registered for the transaction before a
final transaction commit, which triggers an implicit
sub transaction commit. so at that point, and in light
of the other jars that will throw exceptions, sub3
must either call tpc_abort or abort_sub. if its not
then its a bug.

looking over cvs i don't see any recent relevant
changes... it could be a problem with the tests, but i
can't think of any permutations of the jar list that
would allow anything else to happen.

on another note that suite of tests contains several
tests that are prefixed with BUG that show some
transaction bugs... if someone gets a chance to
investigate/fix them, that would be cool. i did a
writeup on them to zope/zodb-dev  (numbers 2 and 3)

http://lists.zope.org/pipermail/zodb-dev/2002-March/002409.html

i've committed a workaround for number 2 to
Shared/DC/ZRDB/TM.py 

additionally the tracing methods of those tests are
pretty useful as an explorative tool for people who
are interested in seeing how the transaction system
works.

-kapil

--- Jeremy Hylton <jeremy@ZOPE.COM> wrote:
> >>>>> "SH" == background 
> <background@shane.zope.com> writes:
> 
>   SH> Zope2 tests include CMF, ZEO, and
> bsddb3Storage packages.
>   SH>
>
**********************************************************************
>   SH> Zope CVS Head
>   SH>
>
**********************************************************************
>   SH> FullTest.checkVersionIterator() temporarily
> disabled.
>   SH>
>
======================================================================
>   SH> FAIL: testExceptionInSubAbortSub
>   SH> (testTransaction.TransactionTests)
>   SH>
>
----------------------------------------------------------------------
>   SH> Traceback (most recent call last):
>   SH>   File "testTransaction.py", line 494, in
>   SH>   testExceptionInSubAbortSub
>   SH> AssertionError
>   SH>
>
----------------------------------------------------------------------
>   SH> Ran 1764 tests in 311.825s
> 
> Kapil-- 
> 
> Isn't this a test you added recently?  Any idea why
> it fails
> intermittently?  I've been meaning to look, but I
> keep getting
> distracted before I get to it.  We should really fix
> it and not leave
> buggy code on the trunk. 



> 
> Jeremy
> 




__________________________________________________
Do You Yahoo!?
Yahoo! Movies - coverage of the 74th Academy Awards®
http://movies.yahoo.com/