3 Replies Latest reply on Sep 19, 2006 11:15 AM by Onno de Groote

    QueuedPessimistic  Locking Mechanism & Deadlock

    ajordens Newbie

      I've recently migrated our application from JBoss 3.2.4 to 3.2.7 and now 4.0.1.

      We are actively trying to solve a deadlock issue that is rearing its head too frequently.

      We are using the Standard 2.X Entity Bean configuration with commit option A and QueuedPessimistic locking. The problem appears when our desktop application (swing app connection to JBoss using http/rmi) makes almost simultaineous calls to the app server requesting similar data.

      We use xdoclet to generate our descriptors and ejb interfaces, and have marked the get* methods as being read-only. As I now understand it, this doesn't mean that it never gets locked, but instead only gets locked for the duration of the method invocation and not the transaction. Is this correct?

      Our generated jboss.xml has the following entry for each bean.

       <method-attributes>
       <method>
       <method-name>get*</method-name>
       <read-only>true</read-only>
       </method>
       </method-attributes>


      Does that make sense? Are there any suggestions or work-arounds for how we could try to lessen the impact of dead-locks on operations that are at least created by read operations.

      I've included a stack trace below.

      14:50:16,289 ERROR [LogInterceptor] TransactionRolledbackLocalException in method: public abstract com.XXX.SampleArtifactHolder com.XXX.SampleArtifact.getSampleArtifactHolder(com.genologics.common.interfaces.processmanager.ProcessArtifactHolder) throws javax.ejb.FinderException,javax.ejb.RemoveException,javax.ejb.CreateException,javax.naming.NamingException, causedBy:
      org.jboss.util.deadlock.ApplicationDeadlockException: Application deadlock detected, resource=org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock@36851f, bean=ResultFile, id=4, refs=3, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=king/995, BranchQual=, localId=995], synched=Thread[RMI TCP Connection(79)-127.0.0.1,5,RMI Runtime], timeout=5000, queue=[], holder=TransactionImpl:XidImpl[FormatId=257, GlobalId=king/997, BranchQual=, localId=997], waitingResource=org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock@15dbb76, bean=LCRun, id=1, refs=3, tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=king/997, BranchQual=, localId=997], synched=null, timeout=5000, queue=[TXLOCK waitingTx=TransactionImpl:XidImpl[FormatId=257, GlobalId=king/995, BranchQual=, localId=995] id=0 thread=Thread[RMI TCP Connection(78)-127.0.0.1,5,RMI Runtime] queued=true], waitingResourceHolder=TransactionImpl:XidImpl[FormatId=257, GlobalId=king/997, BranchQual=, localId=997]
       at org.jboss.util.deadlock.DeadlockDetector.deadlockDetection(DeadlockDetector.java:48)
       at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.waitForTx(QueuedPessimisticEJBLock.java:301)
       at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.doSchedule(QueuedPessimisticEJBLock.java:236)
       at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.schedule(QueuedPessimisticEJBLock.java:183)
       at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:85)
       at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:53)
       at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:146)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:123)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
       at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:514)
       at org.jboss.ejb.Container.invoke(Container.java:870)
       at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:413)
       at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:44)
       at $Proxy497.getSampleArtifactHolder(Unknown Source)
       at com.genologics.server.processmanager.ProcessIOTrackerBean.getProcessIOTrackerHolder(ProcessIOTrackerBean.java:495)
       at sun.reflect.GeneratedMethodAccessor144.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:324)
       at org.jboss.invocation.Invocation.performCall(Invocation.java:345)
       at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:1174)
       at org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationInterceptor.java:72)
       at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:273)
       at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:185)
       at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:111)
       at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:242)
       at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:89)
       at org.jboss.ejb.plugins.EntityCreationInterceptor.invoke(EntityCreationInterceptor.java:53)
       at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:48)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:105)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:313)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:146)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:123)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:192)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
       at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:514)
       at org.jboss.ejb.Container.invoke(Container.java:870)
       at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:413)
       at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:44)
       at $Proxy507.getProcessIOTrackerHolder(Unknown Source)