6 Replies Latest reply on May 13, 2019 11:54 AM by Galder Zamarreño

    CacheException when calling EmbeddedCacheManager::stop() - how to gracefully stop EmbeddedCacheManager in an web-application ?

    Dario Sanna Newbie

      Hi, how to gracefully stop an EmbeddedCacheManager in an Web-Application (in contextDestroyed())?

       

      I am using Infinispan 10.0.0Beta3. Calling EmbeddedCacheManager::stop() causes this Exception.

       

      [1;31m16:53:48,729 ERROR org.infinispan.factories.impl.BasicComponentRegistryImpl [] - Error stopping component org.infinispan.counter.api.CounterManager

      org.infinispan.commons.CacheException: Unable to invoke method public void org.infinispan.counter.impl.manager.EmbeddedCounterManager.stop() on object of type EmbeddedCounterManager

          at org.infinispan.commons.util.SecurityActions.lambda$invokeAccessibly$0(SecurityActions.java:83)

          at org.infinispan.commons.util.SecurityActions.doPrivileged(SecurityActions.java:71)

          at org.infinispan.commons.util.SecurityActions.invokeAccessibly(SecurityActions.java:76)

          at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:181)

          at org.infinispan.factories.impl.BasicComponentRegistryImpl.performStop(BasicComponentRegistryImpl.java:601)

          at org.infinispan.factories.impl.BasicComponentRegistryImpl.stopWrapper(BasicComponentRegistryImpl.java:590)

          at org.infinispan.factories.impl.BasicComponentRegistryImpl.stop(BasicComponentRegistryImpl.java:461)

          at org.infinispan.factories.AbstractComponentRegistry.internalStop(AbstractComponentRegistry.java:431)

          at org.infinispan.factories.AbstractComponentRegistry.stop(AbstractComponentRegistry.java:366)

          at org.infinispan.manager.DefaultCacheManager.stop(DefaultCacheManager.java:777)

       

      The status is not stopping and not terminating when the call to EmbeddedCacheManager::stop() is made.

      Is this a bug in EmbeddedCounterManager ? thanks!

        • 2. Re: CacheException when calling EmbeddedCacheManager::stop() - how to gracefully stop EmbeddedCacheManager in an web-application ?
          Dario Sanna Newbie

          here is the complete stack trace (status is not stopping and not terminating when the call to EmbeddedCacheManager::stop() is made):

           

          [m [1;31m09:44:50,038 ERROR org.infinispan.factories.impl.BasicComponentRegistryImpl [] - Error stopping component org.infinispan.counter.api.CounterManager

          org.infinispan.commons.CacheException: Unable to invoke method public void org.infinispan.counter.impl.manager.EmbeddedCounterManager.stop() on object of type EmbeddedCounterManager

              at org.infinispan.commons.util.SecurityActions.lambda$invokeAccessibly$0(SecurityActions.java:83)

              at org.infinispan.commons.util.SecurityActions.doPrivileged(SecurityActions.java:71)

              at org.infinispan.commons.util.SecurityActions.invokeAccessibly(SecurityActions.java:76)

              at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:181)

              at org.infinispan.factories.impl.BasicComponentRegistryImpl.performStop(BasicComponentRegistryImpl.java:601)

              at org.infinispan.factories.impl.BasicComponentRegistryImpl.stopWrapper(BasicComponentRegistryImpl.java:590)

              at org.infinispan.factories.impl.BasicComponentRegistryImpl.stop(BasicComponentRegistryImpl.java:461)

              at org.infinispan.factories.AbstractComponentRegistry.internalStop(AbstractComponentRegistry.java:431)

              at org.infinispan.factories.AbstractComponentRegistry.stop(AbstractComponentRegistry.java:366)

              at org.infinispan.manager.DefaultCacheManager.stop(DefaultCacheManager.java:777)

              at lucom.ip.web.context.WebApplicationInitializer.destroy(WebApplicationInitializer.java:815)

              at lucom.ip.web.context.WebApplicationInitializer.contextDestroyed(WebApplicationInitializer.java:711)

              at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4624)

              at org.apache.catalina.core.StandardContext.stopInternal(StandardContext.java:5263)

              at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)

              at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1443)

              at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1432)

              at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

              at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)

              at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)

              at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:999)

              at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)

              at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1443)

              at org.apache.catalina.core.ContainerBase$StopChild.call(ContainerBase.java:1432)

              at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)

              at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)

              at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)

              at org.apache.catalina.core.ContainerBase.stopInternal(ContainerBase.java:999)

              at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)

              at org.apache.catalina.core.StandardService.stopInternal(StandardService.java:471)

              at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)

              at org.apache.catalina.core.StandardServer.stopInternal(StandardServer.java:791)

              at org.apache.catalina.util.LifecycleBase.stop(LifecycleBase.java:257)

              at org.apache.catalina.startup.Catalina.stop(Catalina.java:755)

              at org.apache.catalina.startup.Catalina.start(Catalina.java:717)

              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.base/java.lang.reflect.Method.invoke(Method.java:566)

              at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:353)

              at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:493)

          Caused by: java.util.concurrent.CompletionException: org.infinispan.commons.CacheException: org.infinispan.IllegalLifecycleStateException: Cache container has been stopped and cannot be reused. Recreate the cache container.

              at org.infinispan.util.concurrent.CompletionStages.join(CompletionStages.java:68)

              at org.infinispan.notifications.Listenable.removeListener(Listenable.java:43)

              at org.infinispan.cache.impl.AbstractDelegatingCache.removeListener(AbstractDelegatingCache.java:561)

              at org.infinispan.counter.impl.listener.CounterManagerNotificationManager.stop(CounterManagerNotificationManager.java:130)

              at org.infinispan.counter.impl.manager.EmbeddedCounterManager.stop(EmbeddedCounterManager.java:101)

              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

              at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)

              at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

              at java.base/java.lang.reflect.Method.invoke(Method.java:566)

              at org.infinispan.commons.util.SecurityActions.lambda$invokeAccessibly$0(SecurityActions.java:79)

              ... 40 more

          Caused by: org.infinispan.commons.CacheException: org.infinispan.IllegalLifecycleStateException: Cache container has been stopped and cannot be reused. Recreate the cache container.

              at org.infinispan.notifications.cachelistener.CacheNotifierImpl.lambda$removeListenerAsync$16(CacheNotifierImpl.java:2039)

              at org.infinispan.manager.impl.LocalClusterExecutor.lambda$submitConsumer$3(LocalClusterExecutor.java:78)

              at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859)

              at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:837)

              at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)

              at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2088)

              at org.infinispan.manager.impl.LocalClusterExecutor.lambda$localInvocation$6(LocalClusterExecutor.java:97)

              at org.infinispan.util.concurrent.BlockingTaskAwareExecutorServiceImpl$RunnableWrapper.run(BlockingTaskAwareExecutorServiceImpl.java:212)

              at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)

              at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)

              at java.base/java.lang.Thread.run(Thread.java:834)

          Caused by: org.infinispan.IllegalLifecycleStateException: Cache container has been stopped and cannot be reused. Recreate the cache container.

              at org.infinispan.manager.DefaultCacheManager.assertIsNotTerminated(DefaultCacheManager.java:1023)

              at org.infinispan.manager.DefaultCacheManager.internalGetCache(DefaultCacheManager.java:474)

              at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:470)

              at org.infinispan.manager.DefaultCacheManager.getCache(DefaultCacheManager.java:456)

              at org.infinispan.manager.impl.AbstractDelegatingEmbeddedCacheManager.getCache(AbstractDelegatingEmbeddedCacheManager.java:188)

              at org.infinispan.manager.impl.UnwrappingEmbeddedCacheManager.getCache(UnwrappingEmbeddedCacheManager.java:25)

              at org.infinispan.notifications.cachelistener.cluster.ClusterListenerRemoveCallable.apply(ClusterListenerRemoveCallable.java:39)

              at org.infinispan.notifications.cachelistener.cluster.ClusterListenerRemoveCallable.apply(ClusterListenerRemoveCallable.java:25)

              at org.infinispan.manager.impl.LocalClusterExecutor.lambda$localInvocation$6(LocalClusterExecutor.java:94)

              ... 4 more

          • 3. Re: CacheException when calling EmbeddedCacheManager::stop() - how to gracefully stop EmbeddedCacheManager in an web-application ?
            Dario Sanna Newbie

            With Infinispan 9.4.11.Final and also with Infinispan.9.4.12.Final the Exception is not thrown, seems to be a bug in Infinispan 10.0.x ?

            • 5. Re: CacheException when calling EmbeddedCacheManager::stop() - how to gracefully stop EmbeddedCacheManager in an web-application ?
              Galder Zamarreño Master

              I'd highly recommend you joined our Zulip chat (I've opened a topic for this issue here) and we can work through the issue. Are you Ok using 9.4.x for now?