Keep workaround permanently for concurrent shutdowns of embedded Infinispan

Closes #9871

Signed-off-by: Alexander Schwartz <aschwart@redhat.com>
This commit is contained in:
Alexander Schwartz 2023-12-12 12:55:33 +01:00 committed by Alexander Schwartz
parent 4e7bd76954
commit 9e4fc3f491
2 changed files with 5 additions and 15 deletions

View file

@ -235,16 +235,8 @@ public class InfinispanNotificationsManager {
// TODO: Look at CacheEventConverter stuff to possibly include value in the event and avoid additional remoteCache request // TODO: Look at CacheEventConverter stuff to possibly include value in the event and avoid additional remoteCache request
try { try {
listenersExecutor.submit(() -> { listenersExecutor.submit(() -> {
/*
workaround for Infinispan 12.1.7.Final to prevent a deadlock while
DefaultInfinispanConnectionProviderFactory is shutting down PersistenceManagerImpl
that acquires a writeLock and this get that acquires a readLock.
First seen with https://issues.redhat.com/browse/ISPN-13664 and still occurs probably due to
https://issues.redhat.com/browse/ISPN-13666 in 13.0.10
Tracked in https://github.com/keycloak/keycloak/issues/9871
*/
Object value = DefaultInfinispanConnectionProviderFactory.runWithReadLockOnCacheManager(() -> Object value = DefaultInfinispanConnectionProviderFactory.runWithReadLockOnCacheManager(() ->
// We've seen deadlocks in Infinispan 14.x when shutting down Infinispan concurrently, therefore wrapping this
remoteCache.get(key) remoteCache.get(key)
); );
eventReceived(key, (Serializable) value); eventReceived(key, (Serializable) value);

View file

@ -89,12 +89,10 @@ public class DefaultInfinispanConnectionProviderFactory implements InfinispanCon
} }
/* /*
workaround for Infinispan 12.1.7.Final to prevent a deadlock while Workaround for Infinispan 12.1.7.Final and tested until 14.0.19.Final to prevent a deadlock while
DefaultInfinispanConnectionProviderFactory is shutting down PersistenceManagerImpl DefaultInfinispanConnectionProviderFactory is shutting down. Kept as a permanent solution and considered
that acquires a writeLock and this removal that acquires a readLock. good enough after a lot of analysis went into this difficult to reproduce problem.
First seen with https://issues.redhat.com/browse/ISPN-13664 and still occurs probably due to See https://github.com/keycloak/keycloak/issues/9871 for the discussion.
https://issues.redhat.com/browse/ISPN-13666 in 13.0.10
Tracked in https://github.com/keycloak/keycloak/issues/9871
*/ */
public static void runWithReadLockOnCacheManager(Runnable task) { public static void runWithReadLockOnCacheManager(Runnable task) {
Lock lock = DefaultInfinispanConnectionProviderFactory.READ_WRITE_LOCK.readLock(); Lock lock = DefaultInfinispanConnectionProviderFactory.READ_WRITE_LOCK.readLock();