You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Aaron Ogburn (Jira)" <ji...@apache.org> on 2021/01/26 19:08:00 UTC

[jira] [Updated] (DBCP-570) Oracle transaction issue

     [ https://issues.apache.org/jira/browse/DBCP-570?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aaron Ogburn updated DBCP-570:
------------------------------
    Description: 
A failure can be seen when using two connections from different DBCP pools to access Oracle in a single transaction. The pools must access the same database server/SID but the users must be different. In such cases, Oracle has issues that result in a failure at the point of connection enlistment:
{code:java}
 ... WARN [main] sun.reflect.NativeMethodAccessorImpl.invoke0 ARJUNA016089: TransactionImple.enlistResource - xa_start - caught: XAException.XAER_RMERR for < formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff0a000264:a0d3:5fdbca1d:a, node_name=1, branch_uid=0:ffff0a000264:a0d3:5fdbca1d:c, subordinatenodename=null, eis_name=0 >
 oracle.jdbc.xa.OracleXAException: XAErr (-3): A resource manager error has occured in the transaction branch. ORA-24774 SQLErr (0)
 at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1092)
 at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:272)
 at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:741)
 at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:423)
 at org.apache.tomcat.dbcp.dbcp2.managed.TransactionContext.setSharedConnection(TransactionContext.java:109)
 at org.apache.tomcat.dbcp.dbcp2.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:157)
 at org.apache.tomcat.dbcp.dbcp2.managed.ManagedConnection.<init>(ManagedConnection.java:75)
 at org.apache.tomcat.dbcp.dbcp2.managed.ManagedDataSource.getConnection(ManagedDataSource.java:80)
 at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563)
 at support.jboss.web.TransactionTest.executeSQL(TransactionTest.java:84){code}
 We also verified that the explanation/presumed cause is correct by using a Byteman based workaround (which is probably *too* aggressive for some cases but does work around the problem scenario) that simulates what is done by IronJacamar and what is suggested/discussed in [1] - i.e. force the OracleXAResource "true" return for isSameRM to be "false" (instead) via a proxy for the OracleXAResource implementation.
{code:java}
RULE oracle.jdbc.xa.OracleXAResource.isSameRM.FALSE
CLASS oracle.jdbc.xa.OracleXAResource
METHOD isSameRM
AT ENTRY
IF true
DO System.err.println("[BMAN] Overriding Oracle isSameRM ...");
 return false;
ENDRULE{code}
Is it possible for DBCP to better handle this Oracle specific scenario?

[1] [http://www.tomee-openejb.979440.n4.nabble.com/Oracle-XA-with-different-credentials-fails-td4680456.html]

[2] [https://community.oracle.com/tech/developers/discussion/1058320/ora-24774-why-does-xa-start-fails-for-2-txn-branches-on-same-instance]

  was:
A failure can be seen when using two connections from different DBCP pools to access Oracle in a single transaction. The pools must access the same database server/SID but the users must be different. In such cases, Oracle has issues that result in a failure at the point of connection enlistment:
{code:java}
 ... WARN [main] sun.reflect.NativeMethodAccessorImpl.invoke0 ARJUNA016089: TransactionImple.enlistResource - xa_start - caught: XAException.XAER_RMERR for < formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff0a000264:a0d3:5fdbca1d:a, node_name=1, branch_uid=0:ffff0a000264:a0d3:5fdbca1d:c, subordinatenodename=null, eis_name=0 >
 oracle.jdbc.xa.OracleXAException: XAErr (-3): A resource manager error has occured in the transaction branch. ORA-24774 SQLErr (0)
 at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1092)
 at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:272)
 at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:741)
 at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:423)
 at org.apache.tomcat.dbcp.dbcp2.managed.TransactionContext.setSharedConnection(TransactionContext.java:109)
 at org.apache.tomcat.dbcp.dbcp2.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:157)
 at org.apache.tomcat.dbcp.dbcp2.managed.ManagedConnection.<init>(ManagedConnection.java:75)
 at org.apache.tomcat.dbcp.dbcp2.managed.ManagedDataSource.getConnection(ManagedDataSource.java:80)
 at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563)
 at support.jboss.web.TransactionTest.executeSQL(TransactionTest.java:84){code}
 We also verified that the explanation/presumed cause is correct by using a Byteman based workaround (which is probably *too* aggressive for some cases but does work around the problem scenario) that simulates what is done by IronJacamar and what is suggested/discussed in [1] - i.e. force the OracleXAResource "true" return for isSameRM to be "false" (instead) via a proxy for the OracleXAResource implementation.
{code:java}
RULE oracle.jdbc.xa.OracleXAResource.isSameRM.FALSE
CLASS oracle.jdbc.xa.OracleXAResource
METHOD isSameRM
AT ENTRY
IF true
DO System.err.println("[BMAN] Overriding Oracle isSameRM ...");
 return false;
ENDRULE{code}
Our testcase is [3]. Is it possible for DBCP to better handle this Oracle specific scenario?

[1] http://www.tomee-openejb.979440.n4.nabble.com/Oracle-XA-with-different-credentials-fails-td4680456.html

[2] https://community.oracle.com/tech/developers/discussion/1058320/ora-24774-why-does-xa-start-fails-for-2-txn-branches-on-same-instance

[3] https://gitlab.cee.redhat.com/sfikes-test/share/-/tree/case02822330-test-narayana-dbcp-oracle


> Oracle transaction issue
> ------------------------
>
>                 Key: DBCP-570
>                 URL: https://issues.apache.org/jira/browse/DBCP-570
>             Project: Commons DBCP
>          Issue Type: Bug
>    Affects Versions: 2.8.0
>            Reporter: Aaron Ogburn
>            Priority: Major
>
> A failure can be seen when using two connections from different DBCP pools to access Oracle in a single transaction. The pools must access the same database server/SID but the users must be different. In such cases, Oracle has issues that result in a failure at the point of connection enlistment:
> {code:java}
>  ... WARN [main] sun.reflect.NativeMethodAccessorImpl.invoke0 ARJUNA016089: TransactionImple.enlistResource - xa_start - caught: XAException.XAER_RMERR for < formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffff0a000264:a0d3:5fdbca1d:a, node_name=1, branch_uid=0:ffff0a000264:a0d3:5fdbca1d:c, subordinatenodename=null, eis_name=0 >
>  oracle.jdbc.xa.OracleXAException: XAErr (-3): A resource manager error has occured in the transaction branch. ORA-24774 SQLErr (0)
>  at oracle.jdbc.xa.OracleXAResource.checkError(OracleXAResource.java:1092)
>  at oracle.jdbc.xa.client.OracleXAResource.start(OracleXAResource.java:272)
>  at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:741)
>  at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.enlistResource(TransactionImple.java:423)
>  at org.apache.tomcat.dbcp.dbcp2.managed.TransactionContext.setSharedConnection(TransactionContext.java:109)
>  at org.apache.tomcat.dbcp.dbcp2.managed.ManagedConnection.updateTransactionStatus(ManagedConnection.java:157)
>  at org.apache.tomcat.dbcp.dbcp2.managed.ManagedConnection.<init>(ManagedConnection.java:75)
>  at org.apache.tomcat.dbcp.dbcp2.managed.ManagedDataSource.getConnection(ManagedDataSource.java:80)
>  at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1563)
>  at support.jboss.web.TransactionTest.executeSQL(TransactionTest.java:84){code}
>  We also verified that the explanation/presumed cause is correct by using a Byteman based workaround (which is probably *too* aggressive for some cases but does work around the problem scenario) that simulates what is done by IronJacamar and what is suggested/discussed in [1] - i.e. force the OracleXAResource "true" return for isSameRM to be "false" (instead) via a proxy for the OracleXAResource implementation.
> {code:java}
> RULE oracle.jdbc.xa.OracleXAResource.isSameRM.FALSE
> CLASS oracle.jdbc.xa.OracleXAResource
> METHOD isSameRM
> AT ENTRY
> IF true
> DO System.err.println("[BMAN] Overriding Oracle isSameRM ...");
>  return false;
> ENDRULE{code}
> Is it possible for DBCP to better handle this Oracle specific scenario?
> [1] [http://www.tomee-openejb.979440.n4.nabble.com/Oracle-XA-with-different-credentials-fails-td4680456.html]
> [2] [https://community.oracle.com/tech/developers/discussion/1058320/ora-24774-why-does-xa-start-fails-for-2-txn-branches-on-same-instance]



--
This message was sent by Atlassian Jira
(v8.3.4#803005)