-
Bug
-
Resolution: Won't Do
-
Critical
-
None
-
5.4.0.GA
-
None
-
False
-
False
-
Undefined
-
ASF DBCP jira: https://issues.apache.org/jira/browse/DBCP-570
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:
... 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)
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.
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
Is it possible for DBCP to better handle this Oracle specific scenario?