org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Underlying Terracotta connection closed! Can't act on clustered lock anymore...

Terracotta Project Issue Tracker | NIZAR ALSEDDEG | 2 years ago
  1. 0

    Hello Brett Meyer, We have been fighting with this issue for a while, every week we have to restart our service. I am attaching the error below. Is this related to this bug or something different ??? We are using Hibernate 3.2, ehcache 2.6.6 and terracotta-3.7.5.. ERROR 2014-08-04 09:42:51,918 org.hibernate.engine.ActionQueue pool-1-thread-33 - could not release a cache lock org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Underlying Terracotta connection closed! Can't act on clustered lock anymore... at net.sf.ehcache.hibernate.regions.EhcacheTransactionalDataRegion.writeLock(EhcacheTransactionalDataRegion.java:204) at net.sf.ehcache.hibernate.strategy.ReadWriteEhcacheEntityRegionAccessStrategy.afterUpdate(ReadWriteEhcacheEntityRegionAccessStrategy.java:92) at net.sf.ehcache.hibernate.nonstop.NonstopAwareEntityRegionAccessStrategy.afterUpdate(NonstopAwareEntityRegionAccessStrategy.java:82) at org.hibernate.action.EntityUpdateAction.afterTransactionCompletion(EntityUpdateAction.java:256) at org.hibernate.engine.ActionQueue.afterTransactionCompletion(ActionQueue.java:198) at org.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:452) at org.hibernate.jdbc.JDBCContext.afterTransactionCompletion(JDBCContext.java:252) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:150) at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:655) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:709) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:678) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635) at com.X.Y.dao.createDAO$$EnhancerByCGLIB$$1da8f8bd.saveBatch(<generated>) at com.X.Y.service.XyzServlet.createObjectX(XYZ.java:197) Here is the saveBatch method: @Transactional(readOnly = false,isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED) @Override public String saveBatch(final T obj){ String id = null; try { /** * This code will create a new session if one is not already bound to the thread, execute the callback code, * then close the session and release the database connection back to the pool. * Making direct calls to the SessionFactory is not recommended because it is very easy to leak database connections if the sessions are not closed properly. */ id = (String) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException,SQLException { session.setCacheMode(CacheMode.IGNORE); String id = (String)session.save(obj); return id; } }); } catch (JDBCException e) { log.error(e.getLocalizedMessage()); } catch (HibernateException e) { log.error(e.getLocalizedMessage()); } finally { // } return id; } Note: The object we are persisting has is object A -> collections of Y's -> Y has a collections of Z's. We pass object A to saveBatch method... Hibernate mapping: A mapping: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.x.y"> <class name="A" table="A"> <cache usage="read-write" /> <id name="id" length="36" column="id"> <generator class="org.hibernate.id.GUIDGenerator" /> </id> <set name="Y" table="A_Y" cascade="all-delete-orphan" lazy="false" inverse="false" fetch="select"> <cache usage="read-write" /> <key column="id" not-null="true" update="false"/> <many-to-many column="y_id" class="Y" /> </set> </class> </hibernate-mapping> Y mapping: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.x.y"> <class name="Y" table="Y"> <cache usage="read-write" /> <id name="id" length="36" column="id"> <generator class="org.hibernate.id.GUIDGenerator" /> </id> <set name="properties" lazy="false" cascade="all-delete-orphan" inverse="false"> <cache usage="read-write" /> <key column="Y_id" not-null="true" update="true"/> <one-to-many class="Property" /> </set> </class> </hibernate-mapping> Property mapping: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.sensorlogic.device"> <class name="Property" table="property"> <cache usage="read-write" /> <id name="id" length="36" column="id"> <generator class="org.hibernate.id.GUIDGenerator" /> </id> <many-to-one name="Y" class="Y" column="Y_id" update="false" insert="false"/> </class> </hibernate-mapping> We do apprentice your assistance.. This issue become a real mystery , so we are looking to hear back from you. Thanks...!

    Terracotta Project Issue Tracker | 2 years ago | NIZAR ALSEDDEG
    org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Underlying Terracotta connection closed! Can't act on clustered lock anymore...
  2. 0

    Hello Brett Meyer, We have been fighting with this issue for a while, every week we have to restart our service. I am attaching the error below. Is this related to this bug or something different ??? We are using Hibernate 3.2, ehcache 2.6.6 and terracotta-3.7.5.. ERROR 2014-08-04 09:42:51,918 org.hibernate.engine.ActionQueue pool-1-thread-33 - could not release a cache lock org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Underlying Terracotta connection closed! Can't act on clustered lock anymore... at net.sf.ehcache.hibernate.regions.EhcacheTransactionalDataRegion.writeLock(EhcacheTransactionalDataRegion.java:204) at net.sf.ehcache.hibernate.strategy.ReadWriteEhcacheEntityRegionAccessStrategy.afterUpdate(ReadWriteEhcacheEntityRegionAccessStrategy.java:92) at net.sf.ehcache.hibernate.nonstop.NonstopAwareEntityRegionAccessStrategy.afterUpdate(NonstopAwareEntityRegionAccessStrategy.java:82) at org.hibernate.action.EntityUpdateAction.afterTransactionCompletion(EntityUpdateAction.java:256) at org.hibernate.engine.ActionQueue.afterTransactionCompletion(ActionQueue.java:198) at org.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:452) at org.hibernate.jdbc.JDBCContext.afterTransactionCompletion(JDBCContext.java:252) at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:150) at org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:655) at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:709) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:678) at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635) at com.X.Y.dao.createDAO$$EnhancerByCGLIB$$1da8f8bd.saveBatch(<generated>) at com.X.Y.service.XyzServlet.createObjectX(XYZ.java:197) Here is the saveBatch method: @Transactional(readOnly = false,isolation = Isolation.READ_COMMITTED, propagation = Propagation.REQUIRED) @Override public String saveBatch(final T obj){ String id = null; try { /** * This code will create a new session if one is not already bound to the thread, execute the callback code, * then close the session and release the database connection back to the pool. * Making direct calls to the SessionFactory is not recommended because it is very easy to leak database connections if the sessions are not closed properly. */ id = (String) getHibernateTemplate().execute(new HibernateCallback() { public Object doInHibernate(Session session) throws HibernateException,SQLException { session.setCacheMode(CacheMode.IGNORE); String id = (String)session.save(obj); return id; } }); } catch (JDBCException e) { log.error(e.getLocalizedMessage()); } catch (HibernateException e) { log.error(e.getLocalizedMessage()); } finally { // } return id; } Note: The object we are persisting has is object A -> collections of Y's -> Y has a collections of Z's. We pass object A to saveBatch method... Hibernate mapping: A mapping: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.x.y"> <class name="A" table="A"> <cache usage="read-write" /> <id name="id" length="36" column="id"> <generator class="org.hibernate.id.GUIDGenerator" /> </id> <set name="Y" table="A_Y" cascade="all-delete-orphan" lazy="false" inverse="false" fetch="select"> <cache usage="read-write" /> <key column="id" not-null="true" update="false"/> <many-to-many column="y_id" class="Y" /> </set> </class> </hibernate-mapping> Y mapping: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.x.y"> <class name="Y" table="Y"> <cache usage="read-write" /> <id name="id" length="36" column="id"> <generator class="org.hibernate.id.GUIDGenerator" /> </id> <set name="properties" lazy="false" cascade="all-delete-orphan" inverse="false"> <cache usage="read-write" /> <key column="Y_id" not-null="true" update="true"/> <one-to-many class="Property" /> </set> </class> </hibernate-mapping> Property mapping: <?xml version="1.0"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.sensorlogic.device"> <class name="Property" table="property"> <cache usage="read-write" /> <id name="id" length="36" column="id"> <generator class="org.hibernate.id.GUIDGenerator" /> </id> <many-to-one name="Y" class="Y" column="Y_id" update="false" insert="false"/> </class> </hibernate-mapping> We do apprentice your assistance.. This issue become a real mystery , so we are looking to hear back from you. Thanks...!

    Terracotta Project Issue Tracker | 2 years ago | NIZAR ALSEDDEG
    org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Underlying Terracotta connection closed! Can't act on clustered lock anymore...
  3. 0

    Issue with Hibernate EHCache program

    Stack Overflow | 2 years ago
    java.lang.ExceptionInInitializerError
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    JBossCache Deadlock in Hibernate BulkOperationC... | JBoss Developer

    jboss.org | 4 months ago
    org.hibernate.cache.CacheException: org.jboss.cache.lock.TimeoutException: Unable to acquire lock on Fqn [/com/foo/Bar/ENTITY] after [10000] milliseconds for requestor [Thread[main,5,main]]! Lock held by [GlobalTransaction::2]
  6. 0

    CacheException: Cannot configure CacheManager

    ehcache | 1 decade ago | mroosendaal
    org.hibernate.cache.CacheException: net.sf.ehcache.CacheException: Cannot configure CacheManager: null

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.cache.CacheException

      net.sf.ehcache.CacheException: Underlying Terracotta connection closed! Can't act on clustered lock anymore...

      at net.sf.ehcache.hibernate.regions.EhcacheTransactionalDataRegion.writeLock()
    2. Ehcache
      NonstopAwareEntityRegionAccessStrategy.afterUpdate
      1. net.sf.ehcache.hibernate.regions.EhcacheTransactionalDataRegion.writeLock(EhcacheTransactionalDataRegion.java:204)
      2. net.sf.ehcache.hibernate.strategy.ReadWriteEhcacheEntityRegionAccessStrategy.afterUpdate(ReadWriteEhcacheEntityRegionAccessStrategy.java:92)
      3. net.sf.ehcache.hibernate.nonstop.NonstopAwareEntityRegionAccessStrategy.afterUpdate(NonstopAwareEntityRegionAccessStrategy.java:82)
      3 frames
    3. Hibernate
      EntityUpdateAction.afterTransactionCompletion
      1. org.hibernate.action.EntityUpdateAction.afterTransactionCompletion(EntityUpdateAction.java:256)
      1 frame
    4. Hibernate
      ActionQueue.afterTransactionCompletion
      1. org.hibernate.engine.ActionQueue.afterTransactionCompletion(ActionQueue.java:198)
      1 frame
    5. Hibernate
      SessionImpl.afterTransactionCompletion
      1. org.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:452)
      1 frame
    6. Hibernate
      JDBCTransaction.commit
      1. org.hibernate.jdbc.JDBCContext.afterTransactionCompletion(JDBCContext.java:252)
      2. org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:150)
      2 frames
    7. Hibernate
      HibernateTransactionManager.doCommit
      1. org.springframework.orm.hibernate3.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:655)
      1 frame
    8. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:709)
      2. org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:678)
      3. org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:321)
      4. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:116)
      4 frames
    9. Spring AOP
      Cglib2AopProxy$DynamicAdvisedInterceptor.intercept
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
      2. org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:635)
      2 frames
    10. com.X.Y
      XyzServlet.createObjectX
      1. com.X.Y.dao.createDAO$$EnhancerByCGLIB$$1da8f8bd.saveBatch(<generated>)
      2. com.X.Y.service.XyzServlet.createObjectX(XYZ.java:197)
      2 frames