[jboss-jira] [JBoss JIRA] Created: (JBAS-5801) New ManagedConnection locking does not play nicely with transaction interleaving

Adrian Brock (JIRA) jira-events at lists.jboss.org
Mon Jul 28 04:47:45 EDT 2008


New ManagedConnection locking does not play nicely with transaction interleaving
--------------------------------------------------------------------------------

                 Key: JBAS-5801
                 URL: https://jira.jboss.org/jira/browse/JBAS-5801
             Project: JBoss Application Server
          Issue Type: Bug
      Security Level: Public (Everyone can see)
          Components: JCA service
    Affects Versions: JBossAS-4.2.3.GA, JBossAS-5.0.0.CR1
            Reporter: Adrian Brock
            Assignee: Jesper Pedersen
             Fix For: JBossAS-5.0.0.CR2, JBossAS-4.2.4.GA


The new locking in the jms resource adapter to avoid race conditions between the asynch rollback
and the normal usage is not playing nicely with transaction interleaving.

When we are using transaction interleaving, there is no such race condition because the "normal usage"
has already been suspended and the managed connection (for normal usage) given to another transaction.

In fact, the new locking in this could cause over contention because besides the lock being irrelevant,
it could actually cause the real current usage of the managed to block.

The problem has actually first show up as incorrect release of the lock:

java.lang.IllegalMonitorStateException
 at java.util.concurrent.locks.ReentrantLock$Sync.tryRelease(ReentrantLock.java:125)
 at java.util.concurrent.locks.AbstractQueuedSynchronizer.release(AbstractQueuedSynchronizer.java:1137)
 at java.util.concurrent.locks.ReentrantLock.unlock(ReentrantLock.java:431)
 at org.jboss.resource.adapter.jms.JmsManagedConnection.unlock(JmsManagedConnection.java:401)
 at org.jboss.resource.adapter.jms.JmsXAResource.commit(JmsXAResource.java:102)
 at org.jboss.resource.connectionmanager.xa.JcaXAResourceWrapper.commit(JcaXAResourceWrapper.java:53)
 at com.arjuna.ats.internal.jta.resources.arjunacore.XAResourceRecord.topLevelCommit(XAResourceRecord.java:502)
 at com.arjuna.ats.arjuna.coordinator.BasicAction.doCommit(BasicAction.java:3107)
 at com.arjuna.ats.arjuna.coordinator.BasicAction.doCommit(BasicAction.java:3022)
 at com.arjuna.ats.arjuna.coordinator.BasicAction.phase2Commit(BasicAction.java:2126)
 at com.arjuna.ats.arjuna.coordinator.BasicAction.End(BasicAction.java:1819)
 at com.arjuna.ats.arjuna.coordinator.TwoPhaseCoordinator.end(TwoPhaseCoordinator.java:88)
 at com.arjuna.ats.arjuna.AtomicAction.commit(AtomicAction.java:177)

but this is really a symptom of taking the lock unnecessarily in the first place.

The fix would be to spot that we are transaction interleaving by keeping track of the "active" xid in 
JmsXAResource wrapper and only doing the locking in the 2PC callbacks if we are the active xid.

-- 
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 jboss-jira mailing list