You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by Rohit Joshi <ro...@gmail.com> on 2009/11/10 13:24:32 UTC

JCS cache causes thread deadlock

Hi,
  I am using JCSCache as a in-memory caching solution for our product.
 Sometime put and remove calls on JCSCache causes a deadlock. See the thread
dump below.
 I couldn't reproduce during the performance test but our team in CZ is able
to reproduce this.  Is it problem due to mis configuration?

I uses jcs-1.3 using maven dependency.   See the cache.ccf below the
thread-dump.

Thread "Thread-790" thread-id 1,518 thread-stateBLOCKEDWaiting on lock:
org.apache.jcs.engine.control.CompositeCache@180575f
 Owned by: Thread-579 Id: 1,306 at:
org.apache.jcs.engine.control.CompositeCache.remove(CompositeCache.java:736)
 at:
org.apache.jcs.engine.control.CompositeCache.remove(CompositeCache.java:702)
 at: org.apache.jcs.access.CacheAccess.remove(CacheAccess.java:362)
 at: com.example.maf.cache.JCSCache.removeObject(JCSCache.java:341)

Thread "Thread-789" thread-id 1,517 thread-stateBLOCKEDWaiting on lock:
org.apache.jcs.engine.control.CompositeCache@180575f
 Owned by: Thread-579 Id: 1,306 at:
org.apache.jcs.engine.control.CompositeCache.remove(CompositeCache.java:736)
 at:
org.apache.jcs.engine.control.CompositeCache.remove(CompositeCache.java:702)
 at: org.apache.jcs.access.CacheAccess.remove(CacheAccess.java:362)
 at: com.example.maf.cache.JCSCache.removeObject(JCSCache.java:341)

Thread "Thread-788" thread-id 1,516 thread-stateBLOCKEDWaiting on lock:
org.apache.jcs.engine.control.CompositeCache@180575f
 Owned by: Thread-579 Id: 1,306 at:
org.apache.jcs.engine.control.CompositeCache.update(CompositeCache.java:162)
 at: org.apache.jcs.access.CacheAccess.put(CacheAccess.java:281)
 at: org.apache.jcs.access.CacheAccess.put(CacheAccess.java:249)
 at: com.example.maf.cache.JCSCache.putObject(JCSCache.java:294)

Thread "Thread-787" thread-id 1,515 thread-stateBLOCKEDWaiting on lock:
org.apache.jcs.engine.control.CompositeCache@180575f
 Owned by: Thread-579 Id: 1,306 at:
org.apache.jcs.engine.control.CompositeCache.remove(CompositeCache.java:736)
 at:
org.apache.jcs.engine.control.CompositeCache.remove(CompositeCache.java:702)
 at: org.apache.jcs.access.CacheAccess.remove(CacheAccess.java:362)
 at: com.example.maf.cache.JCSCache.removeObject(JCSCache.java:341)

Thread "Thread-786" thread-id 1,514 thread-stateBLOCKEDWaiting on lock:
org.apache.jcs.engine.control.CompositeCache@180575f
 Owned by: Thread-579 Id: 1,306 at:
org.apache.jcs.engine.control.CompositeCache.update(CompositeCache.java:162)
 at: org.apache.jcs.access.CacheAccess.put(CacheAccess.java:281)
 at: org.apache.jcs.access.CacheAccess.put(CacheAccess.java:249)
 at: com.example.maf.cache.JCSCache.putObject(JCSCache.java:294)



Here is the cache.ccf file

#
# Default config: don't allow anything to be stored.maxobject=0
jcs.default=
jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=0
jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
jcs.default.cacheattributes.UseMemoryShrinker=false
jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.default.elementattributes.IsEternal=false
jcs.default.elementattributes.IsRemote=false
jcs.default.elementattributes.IsLateral=false
jcs.default.elementattributes.IsSpool=false

#
## Used by subscriber entry
#
jcs.region.subscriber=
jcs.region.subscriber.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.region.subscriber.cacheattributes.MaxObjects=10000
jcs.region.subscriber.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache

jcs.region.subscriber.cacheattributes.UseMemoryShrinker=true
jcs.region.subscriber.cacheattributes.MaxMemoryIdleTimeSeconds=120
jcs.region.subscriber.cacheattributes.ShrinkerIntervalSeconds=180
jcs.region.subscriber.cacheattributes.MaxSpoolPerRun=1000
jcs.region.subscriber.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.region.subscriber.elementattributes.IsEternal=false
jcs.region.subscriber.elementattributes.IsRemote=false
jcs.region.subscriber.elementattributes.IsLateral=false
jcs.region.subscriber.elementattributes.IsSpool=false
jcs.region.subscriber.elementattributes.IdleTime=60
jcs.region.subscriber.elementattributes.MaxLifeSeconds=180

#
## Used for COS, COI
#
jcs.region.shared=
jcs.region.shared.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
jcs.region.shared.cacheattributes.MaxObjects=500
jcs.region.shared.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache

jcs.region.shared.cacheattributes.UseMemoryShrinker=true
jcs.region.shared.cacheattributes.MaxMemoryIdleTimeSeconds=120
jcs.region.shared.cacheattributes.ShrinkerIntervalSeconds=300
jcs.region.shared.cacheattributes.MaxSpoolPerRun=1000
jcs.region.shared.elementattributes=org.apache.jcs.engine.ElementAttributes
jcs.region.shared.elementattributes.IsEternal=false
jcs.region.shared.elementattributes.IsRemote=false
jcs.region.shared.elementattributes.IsLateral=false
jcs.region.shared.elementattributes.IsSpool=false
jcs.region.shared.elementattributes.IdleTime=60
jcs.region.shared.elementattributes.MaxLifeSeconds=300

Re: JCS cache causes thread deadlock

Posted by Rohit Joshi <ro...@gmail.com>.
This issues was due to debug level logging was enabled. Once I disabled the
debug logging, problem is resolved.



On Tue, Nov 10, 2009 at 7:24 AM, Rohit Joshi <ro...@gmail.com>wrote:

> Hi,
>   I am using JCSCache as a in-memory caching solution for our product.
>  Sometime put and remove calls on JCSCache causes a deadlock. See the thread
> dump below.
>  I couldn't reproduce during the performance test but our team in CZ is
> able to reproduce this.  Is it problem due to mis configuration?
>
> I uses jcs-1.3 using maven dependency.   See the cache.ccf below the
> thread-dump.
>
> Thread "Thread-790" thread-id 1,518 thread-stateBLOCKEDWaiting on lock:
> org.apache.jcs.engine.control.CompositeCache@180575f
>  Owned by: Thread-579 Id: 1,306 at:
> org.apache.jcs.engine.control.CompositeCache.remove(CompositeCache.java:736)
>  at:
> org.apache.jcs.engine.control.CompositeCache.remove(CompositeCache.java:702)
>  at: org.apache.jcs.access.CacheAccess.remove(CacheAccess.java:362)
>  at: com.example.maf.cache.JCSCache.removeObject(JCSCache.java:341)
>
> Thread "Thread-789" thread-id 1,517 thread-stateBLOCKEDWaiting on lock:
> org.apache.jcs.engine.control.CompositeCache@180575f
>  Owned by: Thread-579 Id: 1,306 at:
> org.apache.jcs.engine.control.CompositeCache.remove(CompositeCache.java:736)
>  at:
> org.apache.jcs.engine.control.CompositeCache.remove(CompositeCache.java:702)
>  at: org.apache.jcs.access.CacheAccess.remove(CacheAccess.java:362)
>  at: com.example.maf.cache.JCSCache.removeObject(JCSCache.java:341)
>
> Thread "Thread-788" thread-id 1,516 thread-stateBLOCKEDWaiting on lock:
> org.apache.jcs.engine.control.CompositeCache@180575f
>  Owned by: Thread-579 Id: 1,306 at:
> org.apache.jcs.engine.control.CompositeCache.update(CompositeCache.java:162)
>  at: org.apache.jcs.access.CacheAccess.put(CacheAccess.java:281)
>  at: org.apache.jcs.access.CacheAccess.put(CacheAccess.java:249)
>  at: com.example.maf.cache.JCSCache.putObject(JCSCache.java:294)
>
> Thread "Thread-787" thread-id 1,515 thread-stateBLOCKEDWaiting on lock:
> org.apache.jcs.engine.control.CompositeCache@180575f
>  Owned by: Thread-579 Id: 1,306 at:
> org.apache.jcs.engine.control.CompositeCache.remove(CompositeCache.java:736)
>  at:
> org.apache.jcs.engine.control.CompositeCache.remove(CompositeCache.java:702)
>  at: org.apache.jcs.access.CacheAccess.remove(CacheAccess.java:362)
>  at: com.example.maf.cache.JCSCache.removeObject(JCSCache.java:341)
>
> Thread "Thread-786" thread-id 1,514 thread-stateBLOCKEDWaiting on lock:
> org.apache.jcs.engine.control.CompositeCache@180575f
>  Owned by: Thread-579 Id: 1,306 at:
> org.apache.jcs.engine.control.CompositeCache.update(CompositeCache.java:162)
>  at: org.apache.jcs.access.CacheAccess.put(CacheAccess.java:281)
>  at: org.apache.jcs.access.CacheAccess.put(CacheAccess.java:249)
>  at: com.example.maf.cache.JCSCache.putObject(JCSCache.java:294)
>
>
>
> Here is the cache.ccf file
>
> #
> # Default config: don't allow anything to be stored.maxobject=0
> jcs.default=
> jcs.default.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
> jcs.default.cacheattributes.MaxObjects=0
>
> jcs.default.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
> jcs.default.cacheattributes.UseMemoryShrinker=false
> jcs.default.elementattributes=org.apache.jcs.engine.ElementAttributes
> jcs.default.elementattributes.IsEternal=false
> jcs.default.elementattributes.IsRemote=false
> jcs.default.elementattributes.IsLateral=false
> jcs.default.elementattributes.IsSpool=false
>
> #
> ## Used by subscriber entry
> #
> jcs.region.subscriber=
>
> jcs.region.subscriber.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
> jcs.region.subscriber.cacheattributes.MaxObjects=10000
>
> jcs.region.subscriber.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
>
> jcs.region.subscriber.cacheattributes.UseMemoryShrinker=true
> jcs.region.subscriber.cacheattributes.MaxMemoryIdleTimeSeconds=120
> jcs.region.subscriber.cacheattributes.ShrinkerIntervalSeconds=180
> jcs.region.subscriber.cacheattributes.MaxSpoolPerRun=1000
>
> jcs.region.subscriber.elementattributes=org.apache.jcs.engine.ElementAttributes
> jcs.region.subscriber.elementattributes.IsEternal=false
> jcs.region.subscriber.elementattributes.IsRemote=false
> jcs.region.subscriber.elementattributes.IsLateral=false
> jcs.region.subscriber.elementattributes.IsSpool=false
> jcs.region.subscriber.elementattributes.IdleTime=60
> jcs.region.subscriber.elementattributes.MaxLifeSeconds=180
>
> #
> ## Used for COS, COI
> #
> jcs.region.shared=
>
> jcs.region.shared.cacheattributes=org.apache.jcs.engine.CompositeCacheAttributes
> jcs.region.shared.cacheattributes.MaxObjects=500
>
> jcs.region.shared.cacheattributes.MemoryCacheName=org.apache.jcs.engine.memory.lru.LRUMemoryCache
>
> jcs.region.shared.cacheattributes.UseMemoryShrinker=true
> jcs.region.shared.cacheattributes.MaxMemoryIdleTimeSeconds=120
> jcs.region.shared.cacheattributes.ShrinkerIntervalSeconds=300
> jcs.region.shared.cacheattributes.MaxSpoolPerRun=1000
> jcs.region.shared.elementattributes=org.apache.jcs.engine.ElementAttributes
> jcs.region.shared.elementattributes.IsEternal=false
> jcs.region.shared.elementattributes.IsRemote=false
> jcs.region.shared.elementattributes.IsLateral=false
> jcs.region.shared.elementattributes.IsSpool=false
> jcs.region.shared.elementattributes.IdleTime=60
> jcs.region.shared.elementattributes.MaxLifeSeconds=300
>
>
>
>