Details
-
Bug
-
Resolution: Done
-
Major
-
5.2.0.Beta2
-
None
Description
In certain cases the restart of a stopped cache fails with "ConfigurationException: Detected interceptor of type [org.infinispan.query.backend.LocalQueryInterceptor] being added to the interceptor chain more than once!"
The error is caused by the fact that query.LifecycleManager stores the interceptor in Configuration.customInterceptorConfig on cache start, but doesn't remove it on cache stop.
This causes the interceptor to be added to the InterceptorChain automatically when the InterceptorChain is created (see InterceptorChainFactory.buildCustomInterceptors). When LifecycleManager then tries to add a new query interceptor to the chain, the exception is thrown.
In other cases, the order is reversed: the LifecycleManager is called first (before the InterceptorChainFactory). In these cases there is no error, because ICF.buildCustomInterceptors checks whether the interceptor of a certain type is already in the chain.
I wasn't able to modify QueryCacheRestartTest to make ICF build the chain before LifecycleManager.cacheStarting.
Here's the stacktrace of the error:
10:54:48,638 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC00001: Failed to start service jboss.capedwarf.cache-lifecycle.search.capedwarf-test-a: org.jboss.msc.service.StartException in service jboss.capedwarf.cache-lifecycle.search.capedwarf-test-a: Failed to start service at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.7.0_07] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.7.0_07] at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_07] Caused by: org.infinispan.config.ConfigurationException: Detected interceptor of type [org.infinispan.query.backend.LocalQueryInterceptor] being added to the interceptor chain more than once! at org.infinispan.interceptors.InterceptorChain.assertNotAdded(InterceptorChain.java:108) at org.infinispan.interceptors.InterceptorChain.addInterceptorAfter(InterceptorChain.java:249) at org.infinispan.query.impl.LifecycleManager.createQueryInterceptorIfNeeded(LifecycleManager.java:102) at org.infinispan.query.impl.LifecycleManager.cacheStarting(LifecycleManager.java:78) at org.infinispan.factories.ComponentRegistry.notifyCacheStarting(ComponentRegistry.java:210) at org.infinispan.factories.ComponentRegistry.start(ComponentRegistry.java:196) at org.infinispan.CacheImpl.start(CacheImpl.java:517) at org.infinispan.AbstractDelegatingCache.start(AbstractDelegatingCache.java:343) at org.jboss.as.capedwarf.services.CacheLifecycleService.start(CacheLifecycleService.java:79) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA] ... 3 more