Cache Deadlock When Accessing a Cache From Within a MapListener (Doc ID 578627.1)

Last updated on NOVEMBER 03, 2016

Applies to:

Oracle Coherence - Version 3.2.0 to 3.7.1
Information in this document applies to any platform.
***Checked for relevance on 24-FEB-2013***

Symptoms

When accessing a cache from a MapListener registered on that same cache, it is possible to deadlock the client threads (threads accessing the cache) and the event dispatcher thread responsible for executing the map listener.

Client threads will look like this:

"Thread-1" daemon prio=5 tid=0x00519730 nid=0x1871a00 waiting on condition [0xb1214000..0xb1214d10]
        at java.lang.Thread.sleep(Native Method)
        at com.tangosol.coherence.component.util.Daemon.sleep(Daemon.CDB:9)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.Service$EventDispatcher.drainOverflow(Service.CDB:15)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.Service.post(Service.CDB:17)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.Service.send(Service.CDB:1)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.Service.poll(Service.CDB:12)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.Service.poll(Service.CDB:18)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.DistributedCache$BinaryMap.put(DistributedCache.CDB:32)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.DistributedCache$BinaryMap.put(DistributedCache.CDB:1)
        at com.tangosol.util.ConverterCollections$ConverterObservableMap.put(ConverterCollections.java:1796)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.DistributedCache$ViewMap.put(DistributedCache.CDB:1)
        at com.tangosol.coherence.component.util.SafeNamedCache.put(SafeNamedCache.CDB:1)
        at com.tangosol.net.cache.CachingMap.put(CachingMap.java:929)
        at com.tangosol.net.cache.CachingMap.put(CachingMap.java:888)
        at com.tangosol.net.cache.CachingMap.put(CachingMap.java:800)
        at Main$1.run(Main.java:37)
        at java.lang.Thread.run(Thread.java:613)


The event dispatch thread will look like this;

"DistributedCache:EventDispatcher" daemon prio=5 tid=0x00519300 nid=0x1871600 in Object.wait() [0xb1193000..0xb1193d10]
        at java.lang.Object.wait(Native Method)
        - waiting on <0x26599f60> (a com.tangosol.util.WrapperConcurrentMap$Lock)
        at com.tangosol.util.WrapperConcurrentMap$Lock.waitForNotify(WrapperConcurrentMap.java:566)
        at com.tangosol.util.WrapperConcurrentMap$Lock.assign(WrapperConcurrentMap.java:525)
        at com.tangosol.util.WrapperConcurrentMap.lock(WrapperConcurrentMap.java:118)
        - locked <0x26599f60> (a com.tangosol.util.WrapperConcurrentMap$Lock)
        at com.tangosol.net.cache.CachingMap.get(CachingMap.java:461)
        at Main.onMapEvent(Main.java:18)
        at com.tangosol.util.MultiplexingMapListener.entryUpdated(MultiplexingMapListener.java:41)
        at com.tangosol.util.MapEvent.dispatch(MapEvent.java:195)
        at com.tangosol.util.MapEvent.dispatch(MapEvent.java:164)
        at com.tangosol.util.MapListenerSupport.fireEvent(MapListenerSupport.java:556)
        at com.tangosol.coherence.component.util.SafeNamedCache.translateMapEvent(SafeNamedCache.CDB:7)
        at com.tangosol.coherence.component.util.SafeNamedCache.entryUpdated(SafeNamedCache.CDB:1)
        at com.tangosol.util.MapEvent.dispatch(MapEvent.java:195)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.DistributedCache$ViewMap$ProxyListener.dispatch(DistributedCache.CDB:22)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.service.DistributedCache$ViewMap$ProxyListener.entryUpdated(DistributedCache.CDB:1)
        at com.tangosol.util.MapEvent.dispatch(MapEvent.java:195)
        at com.tangosol.coherence.component.util.CacheEvent.run(CacheEvent.CDB:18)
        at com.tangosol.coherence.component.util.daemon.queueProcessor.Service$EventDispatcher.onNotify(Service.CDB:17)
        at com.tangosol.coherence.component.util.Daemon.run(Daemon.CDB:35)
        at java.lang.Thread.run(Thread.java:613) 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms