ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yakov Zhdanov <yzhda...@apache.org>
Subject Re: Problem with cache expiry and lock
Date Tue, 05 Jan 2016 10:18:58 GMT
>From what I see thread cannot acquire lock for segment in cache map. Given
it already holds lock for individual entry and "main" thread has acquired
lock for segment and tries to lock that individual entry (which is proper
order we follow in Ignite). This is canonical deadlock and also one of the
reasons why complex operations are not permitted from listeners called in
sensitive synchronization blocks.

--Yakov

2016-01-04 17:37 GMT+03:00 kevin <kevin.chan@leonardo.com>:

> Thanks Val, your advice has solved the problem for me.
>
> I'm surprised this code worked for you though. Here's a thread dump I took
> if you want to look into it. The listener is stuck on unlocking the key,
> which kinda makes sense to me now that you said the key is already locked.
> I'm using Ignite 1.4
>
> "ttl-cleanup-worker-test-#62%null%":
>         at sun.misc.Unsafe.park(Native Method)
>         - parking to wait for  <0x0000000642532a78> (a
> java.util.concurrent.locks.ReentrantLock$NonfairSync)
>         at
> java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
>         at
>
> java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:836)
>         at
>
> java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:870)
>         at
>
> java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1199)
>         at
>
> java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:209)
>         at
> java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:285)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$Segment.putIfObsolete(GridCacheConcurrentMap.java:1044)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap.putEntryIfObsoleteOrAbsent(GridCacheConcurrentMap.java:531)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheAdapter.entry0(GridCacheAdapter.java:941)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheAdapter.peekEx(GridCacheAdapter.java:878)
>         at
>
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter.peekExx(GridDhtCacheAdapter.java:344)
>         at
>
> org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache.unlockAll(GridDhtColocatedCache.java:454)
>         at
>
> org.apache.ignite.internal.processors.cache.CacheLockImpl.unlock(CacheLockImpl.java:186)
>         ----test code
>         at
>
> org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager$UserListenerWrapper.onEvent(GridEventStorageManager.java:1181)
>         at
>
> org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager.notifyListeners(GridEventStorageManager.java:770)
>         at
>
> org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager.notifyListeners(GridEventStorageManager.java:755)
>         at
>
> org.apache.ignite.internal.managers.eventstorage.GridEventStorageManager.record(GridEventStorageManager.java:295)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheEventManager.addEvent(GridCacheEventManager.java:266)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheEventManager.addEvent(GridCacheEventManager.java:204)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheMapEntry.onTtlExpired(GridCacheMapEntry.java:3379)
>         - locked <0x00000006411b6770> (a
>
> org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCacheEntry)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheTtlManager.expire(GridCacheTtlManager.java:117)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheTtlManager$CleanupWorker.body(GridCacheTtlManager.java:136)
>         at
> org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:110)
>         at java.lang.Thread.run(Thread.java:745)
> "main":
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheMapEntry.obsolete(GridCacheMapEntry.java:2594)
>         - waiting to lock <0x00000006411b6770> (a
>
> org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCacheEntry)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap$Segment.putIfObsolete(GridCacheConcurrentMap.java:1074)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheConcurrentMap.putEntryIfObsoleteOrAbsent(GridCacheConcurrentMap.java:531)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheAdapter.entry0(GridCacheAdapter.java:941)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheAdapter.entryEx(GridCacheAdapter.java:925)
>         at
>
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter.entryEx(GridDhtCacheAdapter.java:363)
>         at
>
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtCacheAdapter.entryExx(GridDhtCacheAdapter.java:382)
>         at
>
> org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache.entryExx(GridDhtColocatedCache.java:167)
>         at
>
> org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture.addLocalKey(GridDhtColocatedLockFuture.java:1133)
>         at
>
> org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture.mapAsPrimary(GridDhtColocatedLockFuture.java:1092)
>         at
>
> org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture.map(GridDhtColocatedLockFuture.java:713)
>         at
>
> org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture.mapOnTopology(GridDhtColocatedLockFuture.java:655)
>         at
>
> org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedLockFuture.map(GridDhtColocatedLockFuture.java:607)
>         at
>
> org.apache.ignite.internal.processors.cache.distributed.dht.colocated.GridDhtColocatedCache.lockAllAsync(GridDhtColocatedCache.java:425)
>         at
>
> org.apache.ignite.internal.processors.cache.distributed.GridDistributedCacheAdapter.lockAllAsync(GridDistributedCacheAdapter.java:117)
>         at
>
> org.apache.ignite.internal.processors.cache.GridCacheAdapter.lockAll(GridCacheAdapter.java:3277)
>         at
>
> org.apache.ignite.internal.processors.cache.CacheLockImpl.lock(CacheLockImpl.java:72)
>         ----test code
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at
>
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>         at
>
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>         at java.lang.reflect.Method.invoke(Method.java:497)
>         at
> com.intellij.rt.execution.application.AppMain.main(AppMain.java:140)
>
>
>
> --
> View this message in context:
> http://apache-ignite-users.70518.x6.nabble.com/Problem-with-cache-expiry-and-lock-tp2363p2372.html
> Sent from the Apache Ignite Users mailing list archive at Nabble.com.
>

Mime
View raw message