-
1. Re: Connection with associated transaction in invalid state is placed back in the pool?
marklittle Jan 6, 2010 5:40 AM (in response to ksengupta)As the error indicates, the transaction associated with the thread has been marked as rollback-only. That means any attempt to do further work within the scope of that transaction will fail. That's not a bug in the code: it's a clear attempt by the transaction system to ensure data integrity.
You need to figure out why the transaction has been marked for rollback-only. It could be as relatively simple as the fact that the transaction has timed out, in which case either decrease the amount of work done within that transaction or increase the timeout associated with it. Or it could be something else, in which case attach a debugger (or turn on debug in the logger).
-
2. Re: Connection with associated transaction in invalid state is placed back in the pool?
ksengupta Jan 6, 2010 5:44 AM (in response to marklittle)Thanks Mark. It is indeed due to transaction timeout. But the question here is when the associated transaction is marked as rollback-only, how does the connection make its way back to the pool? -
3. Re: Connection with associated transaction in invalid state is placed back in the pool?
mmusgrov Jan 7, 2010 11:22 AM (in response to ksengupta)What are the other errors in the stack trace. -
4. Re: Connection with associated transaction in invalid state is placed back in the pool?
marklittle Jan 8, 2010 6:20 AM (in response to ksengupta)What makes you think it's being put back into the pool? -
5. Re: Connection with associated transaction in invalid state is placed back in the pool?
ksengupta Jan 8, 2010 8:21 AM (in response to marklittle)Because the exception is thrown when a connection is requested from the DataSource.
ds.getConnection();
-
6. Re: Connection with associated transaction in invalid state is placed back in the pool?
marklittle Jan 8, 2010 8:39 AM (in response to ksengupta)Have you tried this with a more up-to-date version of JBossAS?1 of 1 people found this helpful -
7. Re: Connection with associated transaction in invalid state is placed back in the pool?
ksengupta Jan 8, 2010 8:51 AM (in response to marklittle)The version of our product supports Jboss 4.2.2 only and many customers are using this configuration. Even if higher Jboss version solves the problem we cannot advise that. That is why we are trying to see if this kind of issue has been reported and a patch is available for Jboss 4.2.2 -
8. Re: Connection with associated transaction in invalid state is placed back in the pool?
mmusgrov Jan 8, 2010 9:04 AM (in response to ksengupta)The stack trace says "see the previous warnings". What were these warnings? -
9. Re: Connection with associated transaction in invalid state is placed back in the pool?
marklittle Jan 8, 2010 9:25 AM (in response to ksengupta)Try a later version yourself. If it's not a problem there then you can work backwards. -
10. Re: Connection with associated transaction in invalid state is placed back in the pool?
jhalliday Jan 8, 2010 10:07 AM (in response to ksengupta)1 of 1 people found this helpful> Unabled to enlist resource... status: ActionStatus.ABORT_ONLY
> This implies that a connection with invalid transaction is put back in the connection pool and when a new connection is requested using the data source and the same transaction is returned from the pool we get the above exception.
No it doesn't. There is no indication the connection itself is at fault - it may be valid and usable. Connections in the pool are not associated to any tx- the association happens at checkout time and connections are not returned to the pool until disassociated.
.
It's not spec compliant to enlist a resource into a transaction that has been marked rollback only - hence the error. To avoid this problem you should check the transaction status before calling getConnection or doing anything else that may enlist a resource.
-
11. Re: Connection with associated transaction in invalid state is placed back in the pool?
ksengupta Jan 8, 2010 11:58 AM (in response to jhalliday)Thanks, I will try it out and update the thread with both the suggestions.