-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Hibernate + JBossCache + bulk updates = lock problem
PostPosted: Fri Apr 27, 2007 7:55 pm 
Regular
Regular

Joined: Thu Aug 26, 2004 9:23 pm
Posts: 71
I'm using:

Hibernate 3.2.3
JBossCache 1.4.1SP3 with pessimistic locking

I'm having considerable problems doing bulk updates with jbosscache. Something in the way hibernate evicts entities for jbossCache after a bulk update gives me major locking problems if I read any of the objects involved in the bulk update within the same transaction as the bulk update.

I've tried setting CacheMode.IGNORE on the session in that transaction with no luck.

Anyone have any ideas or experienced the same? If not or if this is expected I'll see if I can create a simple test case and submit a jira issue.

Mike


Code:
16:44:17,795 ERROR ActionQueue: could not release a cache lock
org.hibernate.cache.CacheException: org.jboss.cache.lock.TimeoutException: failure acquiring lock: fqn=/cdol2/model/OrganizationControl, caller=Thread[main,5,main], lock=write owner=GlobalTransaction:<null>:69 (org.jboss.cache.lock.LockStrategyReadCommitted@19ca84)
   at org.hibernate.cache.TreeCache.clear(TreeCache.java:124)
   at org.hibernate.cache.TransactionalCache.clear(TransactionalCache.java:124)
   at org.hibernate.impl.SessionFactoryImpl.evictEntity(SessionFactoryImpl.java:832)
   at org.hibernate.action.BulkOperationCleanupAction.evictEntityRegions(BulkOperationCleanupAction.java:137)
   at org.hibernate.action.BulkOperationCleanupAction.afterTransactionCompletion(BulkOperationCleanupAction.java:116)
   at org.hibernate.engine.ActionQueue.afterTransactionCompletion(ActionQueue.java:170)
   at org.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:424)
   at org.hibernate.jdbc.JDBCContext.afterTransactionCompletion(JDBCContext.java:225)
   at org.hibernate.transaction.CacheSynchronization.afterCompletion(CacheSynchronization.java:85)
   at org.objectweb.jotm.SubCoordinator.doAfterCompletion(SubCoordinator.java:1569)
   at org.objectweb.jotm.SubCoordinator.doRollback(SubCoordinator.java:1370)
   at org.objectweb.jotm.SubCoordinator.rollback(SubCoordinator.java:330)
   at org.objectweb.jotm.TransactionImpl.rollback(TransactionImpl.java:668)
   at org.objectweb.jotm.Current.rollback(Current.java:538)
   at org.springframework.transaction.jta.JtaTransactionManager.doRollback(JtaTransactionManager.java:863)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.processRollback(AbstractPlatformTransactionManager.java:742)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.rollback(AbstractPlatformTransactionManager.java:719)
   at org.springframework.test.AbstractTransactionalSpringContextTests.endTransaction(AbstractTransactionalSpringContextTests.java:280)
   at org.springframework.test.AbstractTransactionalSpringContextTests.onTearDown(AbstractTransactionalSpringContextTests.java:224)
   at org.springframework.test.AbstractSingleSpringContextTests.tearDown(AbstractSingleSpringContextTests.java:125)
   at junit.framework.TestCase.runBare(TestCase.java:130)
   at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:69)
   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 junit.framework.TestSuite.runTest(TestSuite.java:208)
   at junit.framework.TestSuite.run(TestSuite.java:203)
   at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:128)
   at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
   at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: org.jboss.cache.lock.TimeoutException: failure acquiring lock: fqn=/cdol2/model/OrganizationControl, caller=Thread[main,5,main], lock=write owner=GlobalTransaction:<null>:69 (org.jboss.cache.lock.LockStrategyReadCommitted@19ca84)
   at org.jboss.cache.Node.acquire(Node.java:500)
   at org.jboss.cache.interceptors.PessimisticLockInterceptor.acquireNodeLock(PessimisticLockInterceptor.java:379)
   at org.jboss.cache.interceptors.PessimisticLockInterceptor.lock(PessimisticLockInterceptor.java:307)
   at org.jboss.cache.interceptors.PessimisticLockInterceptor.invoke(PessimisticLockInterceptor.java:181)
   at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
   at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:32)
   at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
   at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:365)
   at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:160)
   at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
   at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:183)
   at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5863)
   at org.jboss.cache.TreeCache.remove(TreeCache.java:3871)
   at org.hibernate.cache.TreeCache.clear(TreeCache.java:121)
   ... 33 more
Caused by: org.jboss.cache.lock.TimeoutException: write lock for /cdol2/model/OrganizationControl could not be acquired after 1000 ms. Locks: Read lock owners: []
Write lock owner: GlobalTransaction:<null>:69
(caller=Thread[main,5,main], lock info: write owner=GlobalTransaction:<null>:69 (org.jboss.cache.lock.LockStrategyReadCommitted@19ca84))
   at org.jboss.cache.lock.IdentityLock.acquireWriteLock(IdentityLock.java:206)
   at org.jboss.cache.Node.acquireWriteLock(Node.java:529)
   at org.jboss.cache.Node.acquire(Node.java:476)
   ... 46 more


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 30, 2007 3:27 pm 
Regular
Regular

Joined: Thu Aug 26, 2004 9:23 pm
Posts: 71
bump


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 18, 2007 5:45 pm 
Regular
Regular

Joined: Thu Aug 26, 2004 9:23 pm
Posts: 71
Fixed it was using a custom TreeCacheProvider and didn't see this code in BulkOperationCleanupAction.


Code:
   public void afterTransactionCompletion(boolean success) throws HibernateException {
      ///////////////////////////////////////////////////////////////////////
      // HACK ALERT!!!!!
      if ( session.getFactory().getSettings().getCacheProvider() instanceof org.hibernate.cache.OptimisticTreeCacheProvider
            || session.getFactory().getSettings().getCacheProvider() instanceof org.hibernate.cache.TreeCacheProvider ) {
         return;
      }
      ///////////////////////////////////////////////////////////////////////
      evictEntityRegions();
      evictCollectionRegions();
   }


Changed my custom provider to extend TreeCacheProvider and all is well now.

Mike


Top
 Profile  
 
 Post subject: Re: same problem persist with hiberate 3.3.2-Jboss Cche 3.1.0
PostPosted: Fri Aug 14, 2009 3:29 am 
Newbie

Joined: Thu May 24, 2007 1:10 am
Posts: 7
youngm77 wrote:
Fixed it was using a custom TreeCacheProvider and didn't see this code in BulkOperationCleanupAction.


Code:
   public void afterTransactionCompletion(boolean success) throws HibernateException {
      ///////////////////////////////////////////////////////////////////////
      // HACK ALERT!!!!!
      if ( session.getFactory().getSettings().getCacheProvider() instanceof org.hibernate.cache.OptimisticTreeCacheProvider
            || session.getFactory().getSettings().getCacheProvider() instanceof org.hibernate.cache.TreeCacheProvider ) {
         return;
      }
      ///////////////////////////////////////////////////////////////////////
      evictEntityRegions();
      evictCollectionRegions();
   }


Changed my custom provider to extend TreeCacheProvider and all is well now.

Mike


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.