[Mulgara-dev] Lost phase tokens and revision 220.

Andrae Muys andrae at netymon.com
Wed Apr 11 04:16:56 UTC 2007


Just thought I should send an email to the list to discuss r220 in  
branches/lostphasetokens.

The reason this bug took so long to find, why it was so illusive, is  
that it stemmed from an interaction between JOTM and Mulgara.  As  
anyone who has tried to understand it knows, JTA is appallingly  
documented.  Sun attempts to document it in a mere 19 pages plus some  
classically terse javadoc.

When we wrote the JTA integration code in 2004 our reading of the  
spec suggested that the correct sequence of calls to a resource- 
manager was:

start
end
[prepare]
commit (called without a preceding prepare when the ONE_PHASE_COMMIT  
flag is set)
finish

And indeed this is what JOTM provided.  At some point between 2004  
and 2007 this stopped happening - the final call to finish was  
discarded.  As we used finish to release the phase obtained in start  
this lead to a resource leak: lost phases.

Once I identified this as the problem, I reread the JTA spec.  Then I  
read the OMG CORBA/TSS spec on which the JTA spec is based.

2.8.5 (Resource.forget) reads:
   "This operation is performed only if the resource raised a  
heuristic outcome exception to rollback, commit, commit_one_phase, or  
prepare."

I have since pulled and read the X/Open DTP-XA (C193) spec on which  
the CORBA/TSS spec is based, and on page 62, section 6.3 is
state table and confirms the above sentence.  I strongly suggest  
anyone looking at integrating with JTA largely ignore the JTA spec  
itself and instead pull the TSS and DTP-XA specs and read them.  If  
we had done that back in 2004 this bug wouldn't have happened.

What changed between 2004 and now to change JOTM's behaviour is  
unknown, however it's current behaviour is consistent with the spec,  
and the modifications to the StatementStoreXAResource bring it in  
line with that behaviour.

Rereading these specs and bringing Mulgara completely into line with  
the TSS and DTP-XA specs is going to take a few weeks, but this work  
is only required if we wish to expose an external JTA interface to  
mulgara.  We are now compliant with the state-diagram, and this is  
sufficient for our own internal use of JTA - the things we don't  
fully support are required only for truely distributed transactions.

Andrae

-- 
Andrae Muys
andrae at netymon.com
Principal Mulgara Consultant
Netymon Pty Ltd





More information about the Mulgara-dev mailing list