[seam-issues] [JBoss JIRA] Created: (JBSEAM-4611) Seam transaction management fails after transaction timeout
Tobias Otto (JIRA)
jira-events at lists.jboss.org
Thu Mar 25 04:39:37 EDT 2010
Seam transaction management fails after transaction timeout
Issue Type: Bug
Affects Versions: 2.1.2.GA
Environment: WebSphere 220.127.116.11 (no EJB3 feature pack), BMT
Reporter: Tobias Otto
After a transaction timeout happened on a timer thread, that thread is rendered useless regarding transaction management. The next time Seam tries to start a transaction another IllegalStateException ("transaction not active") is thrown.
I would like to suggest the following change to EntityTransaction.java (in org.jboss.seam.transaction:
public int getStatus() throws SystemException
// $TO 20100318 Patch: getRollbackOnly() throws IllegalStateException, if getActive() = false !
if ( isEntityManagerSet() && getDelegate(). isActive() && getDelegate().getRollbackOnly() )
else if ( isEntityManagerSet() && getDelegate().isActive() )
What did I change?
In the line: if ( isEntityManagerSet() && getDelegate(). isActive() && getDelegate().getRollbackOnly() )
I inserted getDelegate(). isActive() BEFORE getDelegate(). getRollbackOnly() becuase getRollbackOnly() throws an IllegalStateException ("transaction not active") if the transaction isn't "active". I believe the method getStatus() should return "STATUS_NO_TRANSACTION" if thats what the delegate says (it does, when the transaction is "not active")! It shouldn't throw the IllegalStateException.
I have come across that problem, when running a Seam 2.1.2 application inside a IBM WebSphere 18.104.22.168 container (no EJB3 feature pack) letting seam handle the transactions (-> so Bean-Managed-Transaction (BMT) from the viewpoint of the container). The problem first occurs when a transaction of a timer or web services interface goes into timeout (transaction timeout). After that timeout the one thread that the transaction timeout occured in, can't use seam managed transactions any more. And that's because inside the woven-in code for transaction management "getStatus()" is called. And that leads to an IllegalStateException ("transaction not active") when any transactional method of that timer thread is called. It might be that I am doing something wrong initializing the seam lifecycle on the timer thread (it's obviously not a http thread that is handled by seam by default!). And I am observing, that the problem is bound to the thread the transaction timeout occured in.
So there might be something else wrong, because transaction handling works fine, until the first transaction timeout occurs on a timer thread (no problem on a gui / web thread !)
But please comment on my suggestion to change EntityTransaction.java from seam version 2.1.2.
I belive the contract for getStatus() should be to not throw an IllegalStateException when a transaction is "not active" but to return "STATUS_NO_TRANSACTION" in that case.
This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues