-
1. Re: Proper way of suspending transaction after the timeout
mmusgrov May 31, 2016 11:51 AM (in response to tomekadamski)The timeout will mark the transaction as rollback only. When the foo () ejb invocation completes the ejb container will try to commit the transaction and receive the rollback exception. We do not change the association in this case because there was a different outcome from the intended commit and the caller may want to ask for the transaction status. I think the container should handle that and disassociate the context, perhaps smarlow could comment on that.
-
2. Re: Proper way of suspending transaction after the timeout
tomjenkinson May 31, 2016 12:08 PM (in response to mmusgrov)+1 - it would be dangerous to leave the transaction associated with the caller thread in case they did something like this unexpectedly.
tm.begin
call @Required
// timeout
call @Required
tm.commit
The second @Required would use a new transaction.
-
3. Re: Proper way of suspending transaction after the timeout
smarlow May 31, 2016 12:38 PM (in response to mmusgrov)Originally, the EJB container org.jboss.as.ejb3.tx.CMTTxInterceptor.endTransaction() was calling tm.commit() for all status except ROLLEDBACK. For ROLLEDBACK, we were calling tm.rollback. This had the problem of leaving failed transactions associated with the thread.
In 2013, we addressed that and more recently, switched to calling tm.rollback() for ROLLEDBACK/ROLLING_BACK (previously we called tm.suspend). For MARKED_ROLLBACK, we are also calling tm.rollback().
+1 for updating the container(s) to not leave ended transactions associated with the thread, as only the top level container knows when it is the correct time to clear the transaction.
-
4. Re: Proper way of suspending transaction after the timeout
tomjenkinson Jun 7, 2016 9:06 AM (in response to tomekadamski)I moved this to the WildFly discussions as it seems to pertain more to the behaviour of the application server.
-
5. Re: Proper way of suspending transaction after the timeout
tomekadamski Aug 9, 2016 2:54 PM (in response to tomjenkinson)I have diagnosed this issue thoroughly and it turns out that it is not a problem in server behaviour as disassociating thread from the context is part of standard rollback behaviour which is currently implemented in CMTTxInterceptor. The problem was caused by two bugs in narayana and CMTTxInterceptor itself. I prepared two pull requests that fix this issue: AtomicTransaction equals fix by tadamski · Pull Request #1044 · jbosstm/narayana · GitHub and CMTTxInterceptor transaction comparison fix by tadamski · Pull Request #9112 · wildfly/wildfly · GitHub. I'm closing this topic and moving the discussion to github.
-
6. Re: Proper way of suspending transaction after the timeout
tomjenkinson Aug 11, 2016 6:09 AM (in response to tomekadamski)Thanks for the contribution!