Issue Details (XML | Word | Printable)

Key: JDBC-345
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Mark Rotteveel
Reporter: Sascha Horn
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Jaybird JDBC Driver

Rollback managed transaction throws Exception (FBXADataSource)

Created: 05/Mar/14 11:21 AM   Updated: 05/Apr/14 10:40 AM
Component/s: None
Affects Version/s: Jaybird 2.2.3, Jaybird 2.2.4
Fix Version/s: None

File Attachments: 1. Java Source File FBTestBean.java (2 kB)

Environment: Ubuntu 12.4 64bit, JBoss-EAP-6.2 Java JDK 1.7.0_51


 Description  « Hide
Performing an rollback of a container managed transaction (FBXADataSource) throws the following exception:

12:15:03,112 WARN [com.arjuna.ats.jta] (EJB default - 4) ARJUNA016045: attempted rollback of < formatId=131077, gtrid_length=29, bqual_length=36, tx_uid=0:ffffc0a8626f:-4cbae540:53170422:5a, node_name=1, branch_uid=0:ffffc0a8626f:-4cbae540:53170422:5d, subordinatenodename=null, eis_name=unknown eis name > (org.jboss.jca.adapters.jdbc.xa.XAManagedConnection@3593fccd) failed with exception code XAException.XAER_RMERR: org.firebirdsql.jca.FBXAException: invalid database handle (no active connection)
at org.firebirdsql.jca.FBManagedConnection.rollback(FBManagedConnection.java:1038)
at org.jboss.jca.adapters.jdbc.xa.XAManagedConnection.rollback(XAManagedConnection.java:346)
at com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord.topLevelAbort(XAResourceRecord.java:358)
at com.arjuna.ats.arjuna.coordinator.BasicAction.doAbort(BasicAction.java:2875)
at com.arjuna.ats.arjuna.coordinator.BasicAction.doAbort(BasicAction.java:2854)
at com.arjuna.ats.arjuna.coordinator.BasicAction.Abort(BasicAction.java:1632)
at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.cancel(TwoPhaseCoordinator.java:118)
at com.arjuna.ats.arjuna.AtomicAction.abort(AtomicAction.java:186)
at com.arjuna.ats.internal.jta.transaction.arjunacore.TransactionImple.rollbackAndDisassociate(TransactionImple.java:1247)
at com.arjuna.ats.internal.jta.transaction.arjunacore.BaseTransaction.rollback(BaseTransaction.java:143)
at com.arjuna.ats.jbossatx.BaseTransactionManagerDelegate.rollback(BaseTransactionManagerDelegate.java:114)
at org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction(CMTTxInterceptor.java:94) [jboss-as-ejb3-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:276) [jboss-as-ejb3-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:339) [jboss-as-ejb3-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:238) [jboss-as-ejb3-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
at org.jboss.as.ejb3.remote.EJBRemoteTransactionPropagatingInterceptor.processInvocation(EJBRemoteTransactionPropagatingInterceptor.java:79) [jboss-as-ejb3-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
at org.jboss.as.ejb3.component.interceptors.ShutDownInterceptorFactory$1.processInvocation(ShutDownInterceptorFactory.java:64) [jboss-as-ejb3-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:55) [jboss-as-ejb3-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.invokeMethod(MethodInvocationMessageHandler.java:329) [jboss-as-ejb3-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler.access$100(MethodInvocationMessageHandler.java:70) [jboss-as-ejb3-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at org.jboss.as.ejb3.remote.protocol.versionone.MethodInvocationMessageHandler$1.run(MethodInvocationMessageHandler.java:203) [jboss-as-ejb3-7.3.0.Final-redhat-14.jar:7.3.0.Final-redhat-14]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_51]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)

For rollback i use SessionContext.setRollbackOnly().

It looks like the driver tries to rollback the transaction twice!?

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Sascha Horn added a comment - 05/Mar/14 11:23 AM
The attached bean reproduces the exception.
The bean only get the connection and creates an statement.
Nothing else is done.
After that the rollback is performed and the exception occurs.

Mark Rotteveel added a comment - 09/Mar/14 07:59 PM
I have been able to reproduce the exception. When the rollback is performed the transaction is not associated with the connection.

It look like the rollback happens twice:
* JBoss calls end() with flags = XAResource.TMFAIL; which triggers a rollback. this rollback succeeds
* JBoss calls rollback() expliciitly; this rollback fails as the transaction has already been disassociated in the previous rollback

I will need to check the specifications more closely to see if this is correct behavior.


Mark Rotteveel added a comment - 09/Mar/14 08:29 PM
Looking at the X/Open XA Specification an end() with TMFAIL shouldn't rollback directly. Or maybe it should throw a very specific exception to indicate it rolled back in response to the end(), or it should throw a specific exception it doesn't know the xid when the actual rollback is called. I will need to dig deeper.

Mark Rotteveel added a comment - 05/Apr/14 10:40 AM
As far as I can tell, JBoss just logs this as a warning, but it reports the 'transaction abort' to have finished OK (based on looking at the code of the transaction manager used by JBoss). As far as I can tell the current behavior has existed since the original implementation. So for now I will consider this ticket to have low priority (it is something that might be improved in a future version of Jaybird).