• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Fixed
  • nelrahma
  • Reporter: nelrahma
  • May 27, 2009
  • 0
  • Watchers: 2
  • August 20, 2009
  • June 08, 2009

Attachments

Description

When HibernateCache.get is called it checks to see if the change is enabled but the isEnabled call. This acquires a distributed read lock, when doing this and in the ClientLockManagerImpl.lock code path, it blocks the other app threads that’s also doing this check on every get.

Below is the stacktrace and attached is the threaddump.

“PerAppThread-13” - Thread t@126 java.lang.Thread.State: BLOCKED on com.tc.object.lockmanager.impl.ClientLockManagerImpl@4ae0fdfb owned by: PerAppThread-9 at com.tc.object.lockmanager.impl.ClientLockManagerImpl.lock(ClientLockManagerImpl.java:382) at com.tc.object.lockmanager.impl.StripedClientLockManagerImpl.lock(StripedClientLockManagerImpl.java:108) at com.tc.object.lockmanager.impl.ThreadLockManagerImpl.lock(ThreadLockManagerImpl.java:46) at com.tc.object.tx.ClientTransactionManagerImpl.begin(ClientTransactionManagerImpl.java:231) at com.tc.object.bytecode.ManagerImpl.begin(ManagerImpl.java:356) at com.tc.object.bytecode.ManagerImpl.monitorEnter(ManagerImpl.java:532) at com.tc.object.bytecode.ManagerUtil.monitorEnter(ManagerUtil.java:525) at com.tc.object.bytecode.ManagerUtil.monitorEnter(ManagerUtil.java:514) at java.util.concurrent.locks.ReentrantReadWriteLock$DsoLock.lock(ReentrantReadWriteLock.java:44) at java.util.concurrent.locks.ReentrantReadWriteLock$ReadLock.lock(ReentrantReadWriteLock.java) at org.terracotta.modules.hibernatecache.TerracottaHibernateCache.isEnabled(TerracottaHibernateCache.java:73) at org.terracotta.modules.hibernatecache.TerracottaHibernateCache.get(TerracottaHibernateCache.java:127) at org.hibernate.cache.ReadOnlyCache.__wrapped_get(ReadOnlyCache.java:58) at org.hibernate.cache.ReadOnlyCache.get(ReadOnlyCache.java) at org.hibernate.cache.impl.bridge.CollectionAccessStrategyAdapter.get(CollectionAccessStrategyAdapter.java:55) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.initializeCollectionFromCache(DefaultInitializeCollectionEventListener.java:133) at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:71) at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1743) at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:476) at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:867) at org.hibernate.event.def.DefaultLoadEventListener.assembleCacheEntry(DefaultLoadEventListener.java:614) at org.hibernate.event.def.DefaultLoadEventListener.loadFromSecondLevelCache(DefaultLoadEventListener.java:542) at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:397) at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:165) at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:207) at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:126) at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:905) at org.hibernate.impl.SessionImpl.get(SessionImpl.java:842) at org.hibernate.impl.SessionImpl.get(SessionImpl.java:835) at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:182) at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:194) at $Proxy15.find(Unknown Source) at org.springframework.samples.petclinic.jpa.EntityManagerClinic.loadOwner(EntityManagerClinic.java:70) at sun.reflect.GeneratedMethodAccessor17.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy17.loadOwner(Unknown Source) at org.terracotta.petclinic.perftest.PetClinicPerfTestActions.getOwnerAccordingToFetchStrategy(PetClinicPerfTestActions.java:120) at org.terracotta.petclinic.perftest.PetClinicPerfTestActions.getOwner(PetClinicPerfTestActions.java:38) at org.terracotta.petclinic.perftest.PetClinicPerfTestActions\(FastClassByCGLIB\)6a48c588.invoke() at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:191) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:628) at org.terracotta.petclinic.perftest.PetClinicPerfTestActions$$EnhancerByCGLIB$$23707af1.getOwner() at org.terracotta.petclinic.perftest.type.ReadOnlyTest.doTestBody(ReadOnlyTest.java:14) at org.terracotta.petclinic.perftest.AbstractPerfTest.doTestBody(AbstractPerfTest.java:341) at org.terracotta.petclinic.perftest.AbstractPerfTest.runTest(AbstractPerfTest.java:472) at org.terracotta.petclinic.perftest.AbstractPerfTest.access$000(AbstractPerfTest.java:32) at org.terracotta.petclinic.perftest.AbstractPerfTest$1.run(AbstractPerfTest.java:271)

Locked ownable synchronizers: - None

Comments

Fiona OShea 2009-05-29

Is this already fixed?

Nabib El-Rahman 2009-06-08

have isEnabled read as a dirty read.

The TPS for the readonly case went from 34k tps to 67k tps.