• Bug
  • Status: New
  • 2 Major
  • Resolution:
  • ehcache,ehcache-terracotta
  • drb
  • Reporter: nizara
  • August 04, 2014
  • 0
  • Watchers: 2
  • October 03, 2014

Description

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() 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”>

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”>

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”>

We do apprentice your assistance.. This issue become a real mystery , so we are looking to hear back from you.

Thanks…!

Comments

NIZAR ALSEDDEG 2014-08-04

Hello, Please we need help in this issue, we don’t know if its a bug in ehcache or a configuration issues???

Louis Jacomet Jacomet 2014-10-03

The exception you are seeing indicates that you lost connection to the Terracotta Server Array. Can you post the Terracotta client logs? They should say why the connection was lost.