• Bug
  • Status: Closed
  • 2 Major
  • Resolution: Duplicate
  • ehcache-core
  • cdennis
  • Reporter: joro1982
  • May 15, 2012
  • 0
  • Watchers: 4
  • July 27, 2012
  • June 21, 2012

Description

We enabled caching for all our entities, which resulted in a deadlock after a while.

We analyzed the threaddumps, tested with different ehcache versions and we have a supposed offender. First, here’s the relevant part of the stacktrace:

	at net.sf.ehcache.store.chm.SelectableConcurrentHashMap$MemoryStoreSegment.unpinAll(SelectableConcurrentHashMap.java:339)
	at net.sf.ehcache.store.chm.SelectableConcurrentHashMap.unpinAll(SelectableConcurrentHashMap.java:211)
	at net.sf.ehcache.store.MemoryStore.unpinAll(MemoryStore.java:208)
	at net.sf.ehcache.store.FrontEndCacheTier.unpinAll(FrontEndCacheTier.java:92)
	at net.sf.ehcache.Cache.unpinAll(Cache.java:4202)
	at net.sf.ehcache.hibernate.regions.EhcacheTransactionalDataRegion.clear(EhcacheTransactionalDataRegion.java:174)
	at net.sf.ehcache.hibernate.strategy.AbstractEhcacheAccessStrategy.removeAll(AbstractEhcacheAccessStrategy.java:109)
	at net.sf.ehcache.hibernate.nonstop.NonstopAwareEntityRegionAccessStrategy.removeAll(NonstopAwareEntityRegionAccessStrategy.java:221)
	at org.hibernate.action.BulkOperationCleanupAction$EntityCleanup.<init>(BulkOperationCleanupAction.java:206)

EhCacheTransactionalDataRegion.clear() has:

    public final void clear() throws CacheException {
        try {
            cache.removeAll();
            cache.unpinAll();
        }
        .....
    }

The problem is that both removeAll() and unpinAll() try to acquire the same lock. Not sure where that leads us, but in version 2.4.7 there was no unpinAll() method and everything works without a deadlock.

Comments

Chris Dennis 2012-06-21

The combination of the line numbers in the stack trace and the symptoms of the being seen here indicates that the reporter is running 2.5.0 not 2.5.2… fixing issue description to match.

Chris Dennis 2012-06-21

This is a duplicate of EHC-903.