2 Replies Latest reply on Feb 18, 2003 11:23 AM by michael bennett

    MSSQL Server - deadlock victim

    Kozusznik Jan Newbie

      Hi everybody,
      I have problem when I use for JBOSS persitence MS SQL Server2000. In some situations SQL server throw Exception:
      [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Transaction (Process ID 57) was deadlocked on {lock} resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.execute(JDBCStoreEntityCommand.java:94)

      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEntity(JDBCStoreManager.java:589)

      at org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity(CMPPersistenceManager.java:458)

      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(CachedConnectionInterceptor.java:388)

      at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:708)

      at org.jboss.ejb.GlobalTxEntityMap.syncEntities(GlobalTxEntityMap.java:99)

      at org.jboss.ejb.EntityContainer.synchronizeEntitiesWithinTransaction(EntityContainer.java:172)

      at org.jboss.ejb.plugins.cmp.jdbc.JDBCRemoveEntityCommand.execute(JDBCRemoveEntityCommand.java:77)

      at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.removeEntity(JDBCStoreManager.java:635)

      at org.jboss.ejb.plugins.CMPPersistenceManager.removeEntity(CMPPersistenceManager.java:542)

      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.removeEntity(CachedConnectionInterceptor.java:431)

      at org.jboss.ejb.EntityContainer.remove(EntityContainer.java:507)

      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

      at java.lang.reflect.Method.invoke(Method.java:324)

      at org.jboss.ejb.EntityContainer$ContainerInterceptor.invoke(EntityContainer.java:1173)

      at org.jboss.ejb.plugins.cmp.jdbc.JDBCRelationInterceptor.invoke(JDBCRelationInterceptor.java:95)

      at org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invoke(EntitySynchronizationInterceptor.java:308)

      at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)

      at org.jboss.ejb.plugins.EntityReentranceInterceptor.invoke(EntityReentranceInterceptor.java:90)

      at org.jboss.ejb.plugins.EntityInstanceInterceptor.invoke(EntityInstanceInterceptor.java:152)

      at org.jboss.ejb.plugins.EntityLockInterceptor.invoke(EntityLockInterceptor.java:107)

      When I use Oracle or Hypersonic DB this problem do not uccure.
      Could anybody help me.
      versions:
      JBOSS - 3.0.3
      MS SQL 2000 - 8.00.194
      Thanks
      Jan

        • 1. Re: MSSQL Server - deadlock victim
          Milena Newbie

          Hi,
          I have the same problem.I'm using JSQLConnect driver and cannot get rid of this deadlocks.
          If you have a solution please let me know..

          Regards,
          mukoline.

          • 2. Re: MSSQL Server - deadlock victim - deadlock retries
            michael bennett Newbie

            I get the same errors with inet opta drivers...

            I have done some tests with different junit test cases to create some jms messages that then persist to a database and it seems to be sporadic and I usually get the following error.

            im using jboss 3.0.4T with the inet opta drivers on win2k workstation talking to sql server 2k.

            Can anyone point out how to catch a deadlock execption (i.e. what exception class should I be catching) and perhaps some code to outline how I would retry.

            I tried reading all that fantastic and complete documentation out there but I just couldnt find anything on it.. (the deadlocking not the documentation...)

            Micahel


            16:19:08,682 ERROR [GlobalTxEntityMap] Store failed on entity: 1762692705
            javax.ejb.EJBException: Store failed; CausedByException is:
            [SEPA]Transaction (Process ID 76) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the
            transaction.
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.execute(JDBCStoreEntityCommand.java:94)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEntity(JDBCStoreManager.java:589)
            at org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity(CMPPersistenceManager.java:458)
            at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(CachedConnectionInterceptor.java:388)
            at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:708)
            at org.jboss.ejb.GlobalTxEntityMap.syncEntities(GlobalTxEntityMap.java:99)
            at org.jboss.ejb.GlobalTxEntityMap$GlobalTxEntityMapCleanup.beforeCompletion(GlobalTxEntityMap.java:168)
            at org.jboss.tm.TxCapsule.doBeforeCompletion(TxCapsule.java:1394)
            at org.jboss.tm.TxCapsule.commit(TxCapsule.java:364)
            at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:73)
            at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:201)
            at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)
            at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:100)
            at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)
            at org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)
            at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:962)
            at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1038)
            at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:243)
            at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:603)
            at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:417)
            at org.jboss.mq.SpySession.run(SpySession.java:296)
            at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:178)
            at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:655)
            at java.lang.Thread.run(Thread.java:536)
            java.sql.SQLException: [SEPA]Transaction (Process ID 76) was deadlocked on lock resources with another process and has been chosen as the deadlock vic
            tim. Rerun the transaction.
            at com.inet.tds.a.a(Unknown Source)
            at com.inet.tds.b.do(Unknown Source)
            at com.inet.tds.b.executeUpdate(Unknown Source)
            at org.jboss.resource.adapter.jdbc.local.LocalPreparedStatement.executeUpdate(LocalPreparedStatement.java:308)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreEntityCommand.execute(JDBCStoreEntityCommand.java:90)
            at org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.storeEntity(JDBCStoreManager.java:589)
            at org.jboss.ejb.plugins.CMPPersistenceManager.storeEntity(CMPPersistenceManager.java:458)
            at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.storeEntity(CachedConnectionInterceptor.java:388)
            at org.jboss.ejb.EntityContainer.storeEntity(EntityContainer.java:708)
            at org.jboss.ejb.GlobalTxEntityMap.syncEntities(GlobalTxEntityMap.java:99)
            at org.jboss.ejb.GlobalTxEntityMap$GlobalTxEntityMapCleanup.beforeCompletion(GlobalTxEntityMap.java:168)
            at org.jboss.tm.TxCapsule.doBeforeCompletion(TxCapsule.java:1394)
            at org.jboss.tm.TxCapsule.commit(TxCapsule.java:364)
            at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:73)
            at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:201)
            at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)
            at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:100)
            at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)
            at org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)
            at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:962)
            at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1038)
            at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:243)
            at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:603)
            at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:417)
            at org.jboss.mq.SpySession.run(SpySession.java:296)
            at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:178)
            at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:655)
            at java.lang.Thread.run(Thread.java:536)
            16:19:08,692 ERROR [JMSContainerInvoker] Exception in JMSCI message listener
            javax.transaction.RollbackException: Unable to commit, tx=XidImpl [FormatId=257, GlobalId=michaelb//16818, BranchQual=] status=STATUS_ROLLEDBACK
            at org.jboss.tm.TxCapsule.commit(TxCapsule.java:425)
            at org.jboss.tm.TransactionImpl.commit(TransactionImpl.java:73)
            at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:201)
            at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:60)
            at org.jboss.ejb.plugins.RunAsSecurityInterceptor.invoke(RunAsSecurityInterceptor.java:100)
            at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204)
            at org.jboss.ejb.MessageDrivenContainer.invoke(MessageDrivenContainer.java:302)
            at org.jboss.ejb.plugins.jms.JMSContainerInvoker.invoke(JMSContainerInvoker.java:962)
            at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1038)
            at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:243)
            at org.jboss.mq.SpyMessageConsumer.sessionConsumerProcessMessage(SpyMessageConsumer.java:603)
            at org.jboss.mq.SpyMessageConsumer.addMessage(SpyMessageConsumer.java:417)
            at org.jboss.mq.SpySession.run(SpySession.java:296)
            at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:178)
            at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:655)
            at java.lang.Thread.run(Thread.java:536)