Bugs item #585632, was opened at 2002-07-23 22:24
Message generated for change (Settings changed) made by ejort
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=585632&group_id=22866

Category: JBossTX
Group: v3.0 Rabbit Hole
>Status: Closed
>Resolution: Out of Date
Priority: 5
Submitted By: Igor Fedorenko (igorfie)
Assigned to: Nobody/Anonymous (nobody)
Summary: Problem with XA and Oracle

Initial Comment:
org.jboss.tm.TxCapsule#enlistResource(XAResource) 

has an optimization that is not compatible with Oracle. 

The problem occurs only when more then one 

connections to same database server try to participate 

in same distributed transaction. Here what happens



1. First db connection joins transaction; TxCapsules 

sees new resource manager/transaction pair and calls 

XAResource#start(xid1, XAResource.TMNOFLAGS); 

everything works fine.

2. When second db connection tries to join the 

transaction TxCapsule sees same RM/transaction pair 

and tries to call XAResource#start(xid1, 

XAResource.TMJOIN) to attach second connection to 

the transaction. This is not supported by Oracle and the 

call fails with XA_RETRY error code.



It should be possible to turn this optimization on/off on 

per RM basis. As a temporary workaround I would 

disable this optimization (unless some other RM does 

not work without it).



I am running Branch_3_0 on Win2k, JDK 1.3.1_04, 

Oracle 8173.



----------------------------------------------------------------------

Comment By: Igor Fedorenko (igorfie)
Date: 2002-08-03 03:35

Message:
Logged In: YES 
user_id=232950

Ok, you won :-).



I wrote very simple jdbc driver that returns false for all 

isSameRM requests (thanks to Ole for the idea) and 

delegates everything else to oracle driver. Attached is source 

code and sample oracle-xa-service.xml. Unfortunately, the 

code needs oracle libraries to compile. Does it look like 

reasonable solution?



--

Sincerely,

Igor Fedorenko



----------------------------------------------------------------------

Comment By: Igor Fedorenko (igorfie)
Date: 2002-08-03 03:34

Message:
Logged In: YES 
user_id=232950

Ok, you won :-).



I wrote very simple jdbc driver that returns false for all 

isSameRM requests (thanks to Ole for the idea) and 

delegates everything else to oracle driver. Attached is source 

code and sample oracle-xa-service.xml. Unfortunately, the 

code needs oracle libraries to compile. Does it look like 

reasonable solution?



--

Sincerely,

Igor Fedorenko



----------------------------------------------------------------------

Comment By: Scott M Stark (starksm)
Date: 2002-08-02 15:14

Message:
Logged In: YES 
user_id=175228

This is what JCA is for. You have a resource driver that does 

work with an app server JTA, create a JCA wrapper that get 

the two to talk. Write one and we'll include it.

----------------------------------------------------------------------

Comment By: Bill Burke (patriot1burke)
Date: 2002-08-02 14:47

Message:
Logged In: YES 
user_id=176497

Clustering code does not propagate transactional state. In fact, 

entity beans do not have a distributed cache.  For SFSBs, we do 

replicate state, but replicated state is only distributed on 

transaction commit.  If a node fails within a transaction, you 

failover to a new node with old committed state.

----------------------------------------------------------------------

Comment By: Ole Husgaard (sparre)
Date: 2002-08-02 14:35

Message:
Logged In: YES 
user_id=175257

We _do_ check for XA_RDONLY, and act upon it according

the the spec.



To see why starting a different branch for each XAResource

breaks the spec, download the JTA 1.0.1 specification,

and study it's requirements on isSameRM() and the use of

start(TMNOFLAGS/TMJOIN).



If Oracle wanted to comply with the spec, and have a new

transaction branch for each connection, they could simply

make isSameRM() always return false, unless called with the

target of the method as the argument.

That is what the isSameRM() method is for.



Problem is, if we should handle such non-compliant drivers,

we would have to have some kind of per-RM helper or proxy

that takes care of each individual RM's specific spec

violations.

The Tyrex TM has this, and you may be able to make your

driver work in JBoss by using Tyrex instead of the default

TM.



Best Regards,



Ole Husgaard.



P.S: I'm not familiar with the clustering code, and cannot

answer questions about that.



----------------------------------------------------------------------

Comment By: Igor Fedorenko (igorfie)
Date: 2002-07-24 01:59

Message:
Logged In: YES 
user_id=232950

Oracle wants separate transaction branch for each db 

connection (TMNOFLAGS, same global transaction id, 

different branch qualifiers). You should also check for 

XA_RDONLY status from XAResource#prepare (I think 

this complies with the spec). You can find an appropriate 

example here 

http://www.oracle.co.jp/o8i/JServer/sources/jdbc/demo

/samples/oci8/jdbc20-samples/XA3.java.txt. I agree 

that TMJOIN is suggested but I do not see why starting 

different transaction branches for each db connection 

would break the spec. 



As for suggested XA ConnectionManager it should work 

fine with oracle. Btw, does JBOSS share state of 

transaction among nodes of a cluster? If second 

connection was obtained on a different node would 

JBOSS still use TMJOIN?



----------------------------------------------------------------------

Comment By: Ole Husgaard (sparre)
Date: 2002-07-24 00:57

Message:
Logged In: YES 
user_id=175257

This is yet another problem with the Oracle driver.



Please report it to Oracle - I think they loose market

share big time because they do not conform to the JTA

specification, and because they are so slow to fix

these bugs. Currently I can only recommend against using

Oracle with Java, because of this.



But just like with the 8.1.5 "All XIDs are belong to

us"-bug, that we got around by adding extra code, it

might be possible to add some code that checks if the

XAResource class is one of the Oracle classes that have

this problem.

Unfortunately that may give us yet another Oracle

problem once they fix their bug, since TMJOIN _must_

be used here, according to JTA.



Best Regards,



Ole husgaard.



----------------------------------------------------------------------

Comment By: David Jencks (d_jencks)
Date: 2002-07-23 23:20

Message:
Logged In: YES 
user_id=60525

What does work with Oracle?  Does it require all work on one

tx go over the same connection or that other connections'

XAResource get started with TMNOFLAGS or TMRESUME or ???



I've been considering writing a new XA ConnectionManager

that would tie managedConnections to transactions, at least

until you run out, to reduce the amount of enlist/delist

activity.  What do you think are the chances of this

proposal solving the problem you have identified?



My understanding is that calling TMJOIN is the spec required

behavior, so I would expect it to break other drivers. 

However I find this area difficult to pin down as far as

spec requirements.



Thanks

david jencks

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=376685&aid=585632&group_id=22866


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to