0 Replies Latest reply on May 3, 2005 10:19 AM by Frederic Burlet

    Lock contention during test

    Frederic Burlet Newbie

      Hi,

      I'm getting a lock contention during the launch of a junitee test of my application. This lock contention is coming out when I call the remove method on a entity bean.

      My test is quite simple, create needed entities in the setUp() method. Call an entry point of the application by providing some data. Let the application run and remove all the created entities in the tearDown() method.

      When I simulate the flow with a bean shell, everything works fine. I tried to run the test by moving the deletion of created entities (the ones that create this lock contection) in the test itself: not much. I tried to remove the entities in different way: by getting a Collection and iterate over the Collection, by getting a single entry, ...): same.

      I investigated more by tracing org.jboss.tm and org.jboss.ejb.BeanLock... but this is throwing a lot of unreadable (at least for me) logs. If you need these complete logs (more than 12000 lines), let me know.

      Is there any way to detect exactly what is causing this lock contention ? Which transactions are active or whatever that could be interesting to know what is going wrong ?

      I'm running jboss 3.2.4 with java 1.4.2_05-b04 under fedora core 3.

      15:15:35,001 DEBUG [http-0.0.0.0-8880-Processor25] [kservertest.base.OpmEntityCleaner] Remove logtrackandtrace:KIALAB00000001.2005-05-03 15:14:58.932
      15:20:35,023 WARN [Timeouts(1)-1] [jboss.tm.TransactionImpl] Transaction TransactionImpl:XidImpl [FormatId=257, GlobalId=eddie.dev.kiala.com//237, BranchQual=] timed out. status=STATUS_ACTIVE
      15:20:35,025 ERROR [http-0.0.0.0-8880-Processor25] [jboss.ejb.BeanLock] Thread[http-0.0.0.0-8880-Processor25,5,jboss]Saw rolled back tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=eddie.dev.kiala.com//237, B
      ranchQual=] waiting for txLock
      15:20:35,030 WARN [http-0.0.0.0-8880-Processor25] [jboss.tm.TransactionImpl] Lock contention, tx=TransactionImpl:XidImpl [FormatId=257, GlobalId=eddie.dev.kiala.com//237, BranchQual=]
      15:20:35,039 ERROR [http-0.0.0.0-8880-Processor25] [ejb.plugins.LogInterceptor] RuntimeException:
      java.lang.RuntimeException: Transaction marked for rollback, possibly a timeout
       at org.jboss.ejb.plugins.lock.QueuedPessimisticEJBLock.waitForTx(QueuedPessimisticEJBLock.java:366)
       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:54)
       at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:84)
       at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:315)
       at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:148)
       at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:120)
       at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:191)
       at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:122)
       at org.jboss.ejb.EntityContainer.internalInvoke(EntityContainer.java:484)
       at org.jboss.ejb.Container.invoke(Container.java:723)
       at org.jboss.ejb.plugins.local.BaseLocalProxyFactory.invoke(BaseLocalProxyFactory.java:359)
       at org.jboss.ejb.plugins.local.EntityProxy.invoke(EntityProxy.java:44)
       at $Proxy787.remove(Unknown Source)
       at com.kiala.kservertest.base.OpmEntityCleaner.removeLogtrackandtraceByPrimaryKey(OpmEntityCleaner.java:210)
       at com.kiala.kservertest.synch.KialaItemScanningTest.testItem01_02_ItemScanningFeedbackOnlyDelivery(KialaItemScanningTest.java:129)
       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 junit.framework.TestCase.runTest(TestCase.java:154)
       at junit.framework.TestCase.runBare(TestCase.java:127)
       at junit.framework.TestResult$1.protect(TestResult.java:106)
       at junit.framework.TestResult.runProtected(TestResult.java:124)
       at junit.framework.TestResult.run(TestResult.java:109)
       at junit.framework.TestCase.run(TestCase.java:118)
       at org.junitee.runner.TestRunner.run(TestRunner.java:108)
       at org.junitee.servlet.JUnitEEServlet.runTests(JUnitEEServlet.java:233)
       at org.junitee.servlet.JUnitEEServlet.doGet(JUnitEEServlet.java:202)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
       at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:72)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
       at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:275)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
       at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
       at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
       at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
       at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
       at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
       at java.lang.Thread.run(Thread.java:534)