-
Bug
-
Resolution: Done
-
Major
-
None
-
9.0.0.Final
-
None
When new cache is started during ISPN shutdown, it can result into a deadlock.
When new cache is created, first DefaultCacheManager.CacheWrapper is created with a latch. This latch is release once cache is fully started. If in meantime DefaultCacheManager#stop is called, it will first stop and lock GlobalComponentRegistry and after that will try to access and stop all caches. However, if there is present half-created cache (one with latch in DefaultCacheManager.CacheWrapper not released yet), if will result into a deadlock, as cache#start tries to access and lock GlobalComponentRegistry, already lock by DefaultCacheManager.
Relevant pieces of stack traces are bellow, whole stack trace is attached.
Locking of GlobalComponentRegistry by DefaultCacheManager#stop:
at org.infinispan.factories.AbstractComponentRegistry.stop(AbstractComponentRegistry.java:569) - locked <0x00000000e1606fc0> (a org.infinispan.factories.GlobalComponentRegistry) at org.infinispan.factories.GlobalComponentRegistry.stop(GlobalComponentRegistry.java:282) - locked <0x00000000e1606fc0> (a org.infinispan.factories.GlobalComponentRegistry) at org.infinispan.manager.DefaultCacheManager.stop(DefaultCacheManager.java:699) - locked <0x00000000e1606bb0> (a org.infinispan.manager.DefaultCacheManager) at org.infinispan.manager.impl.AbstractDelegatingEmbeddedCacheManager.stop(AbstractDelegatingEmbeddedCacheManager.java:173)
and later of waiting for cache latch:
at sun.misc.Unsafe.park(Native Method) - parking to wait for <0x00000000fd59db80> (a java.util.concurrent.CountDownLatch$Sync) 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.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:997) at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304) at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231) at org.infinispan.manager.DefaultCacheManager$CacheWrapper.getCache(DefaultCacheManager.java:968)
Waiting for a lock for GlobalComponentRegistry when cache is created:
at org.infinispan.factories.AbstractComponentRegistry.getOrCreateComponent(AbstractComponentRegistry.java:277) - waiting to lock <0x00000000e1606fc0> (a org.infinispan.factories.GlobalComponentRegistry) at org.infinispan.factories.GlobalComponentRegistry.getTimeService(GlobalComponentRegistry.java:167) at org.infinispan.factories.ComponentRegistry.getTimeService(ComponentRegistry.java:271) at org.infinispan.distexec.DefaultExecutorService.<init>(DefaultExecutorService.java:190) [...] org.infinispan.manager.DefaultCacheManager.wireAndStartCache(DefaultCacheManager.java:636) at org.infinispan.manager.DefaultCacheManager.createCache(DefaultCacheManager.java:587) at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:452) at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:438)
- is cloned by
-
JDG-826 Deadlock during stopping CacheManager
- Closed