[jboss-jira] [JBoss JIRA] Created: (JBAS-5040) Locked entities won't be released correctly after transaction timeout

Christian Michels (JIRA) jira-events at lists.jboss.org
Mon Dec 3 13:07:51 EST 2007


Locked entities won't be released correctly after transaction timeout
---------------------------------------------------------------------

                 Key: JBAS-5040
                 URL: http://jira.jboss.com/jira/browse/JBAS-5040
             Project: JBoss Application Server
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: Transaction Manager
    Affects Versions: JBossAS-4.2.2.GA
            Reporter: Christian Michels
         Assigned To: Adrian Brock


When locking an entity in a (outer) user transaction and trying to lock the same entitity in a inner transaction (with a smaller txTimeout), the entity will not be released, if the inner transaction timed out.
The entity won't be released until the outer transaction timed out.

With JBoss 4.0.4, the inner transaction rollback will be resolved after a short while:

18:56:14,237 WARN  [TransactionImpl] Transaction TransactionImpl:XidImpl[FormatId=257, GlobalId=PCTR694/17, BranchQual=, localId=17] timed out. status=STATUS_ACTIVE
18:56:17,237 ERROR [BeanLock] Thread[RMI TCP Connection(2)-172.22.6.85,5,RMI Runtime]Saw rolled back tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=PCTR694/17, BranchQual=, localId=17] waiting for txLock
18:56:17,237 ERROR [LogInterceptor] TransactionRolledbackException in method: public abstract void kam.jbosstest.transactionlocking.LockedEntityEJBRemote.loadIntoTransaction() throws java.rmi.RemoteException, causedBy:
java.lang.RuntimeException: Transaction marked for rollback, possibly a timeout
...

e.g.

EntityLockingEJBHome entityLockingHome = (EntityLockingEJBHome) ctx.lookup("EntityLockingEJB");

kam.jbosstest.transactionlocking.EntityLockingEJBRemote entityLockingRemote = entityLockingHome.create();

LockedEntityEJBHome lockedEntityHome =
				(LockedEntityEJBHome) ctx.lookup("LockedEntityEJB");

LockedEntityEJBRemote entity = null;

try {
        entity = lockedEntityHome.findByPrimaryKey(1);
} catch (FinderException e) {
        throw new Exception(e);
}

UserTransaction ut = (UserTransaction) ctx.lookup("UserTransaction");
ut.setTransactionTimeout(10);

System.out.println("Starting transaction (timeout=10s)...");

Date start = new Date(System.currentTimeMillis());

ut.begin();

System.out.println("Date:" + start);

System.out.println("...locking entity in client context...");

entity.loadIntoTransaction();

try{
	System.out.println("...trying to lock the same entity in a new transaction with 2s txTimeout...");
	entityLockingRemote.lockResource(1, 2);
}catch(Exception e){
	e.printStackTrace();
}

Date end = new Date(System.currentTimeMillis());
System.out.println("Application was locked for: " + (end.getTime() - start.getTime()) + "ms instead of about 2s");


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list