Vojtech Juranek created ISPN-6869:
-------------------------------------
Summary: Deadlock during stopping CacheManager
Key: ISPN-6869
URL:
https://issues.jboss.org/browse/ISPN-6869
Project: Infinispan
Issue Type: Bug
Components: Core
Affects Versions: 9.0.0.Alpha3
Reporter: Vojtech Juranek
Assignee: Vojtech Juranek
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}}:
{noformat}
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)
{noformat}
and later of waiting for cache latch:
{noformat}
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)
{noformat}
Waiting for a lock for {{GlobalComponentRegistry}} when cache is created:
{noformat}
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)
{noformat}
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)