6 Replies Latest reply on Apr 16, 2012 4:38 PM by dex chen

    cache is Terminiated for unknown reasons

    dex chen Novice

      Hi, all:


      I randomly saw cache got terminated for unknow reasons.  Is anyone experiencing this? Or what is the root cause?


      I am on ISPN 5.1.3 final using H2DB cache store in embeded fashion. When my code tried to access the cache, it throws following exceptions:

      Cache 'keychain' is in 'TERMINATED' state and so it does not accept new invocations. Either restart it or recreate the cache container.

          at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:108)

          at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:89)

          at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:95)

          at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:60)

          at org.infinispan.interceptors.InterceptorChain.invoke(InterceptorChain.java:345)

          at org.infinispan.CacheImpl.get(CacheImpl.java:272)

          at org.infinispan.CacheImpl.get(CacheImpl.java:264)


      If it is kind expected, what's the suggested ways to monitor this?  thanks.

        • 1. Re: cache is Terminiated for unknown reasons
          PISA DR Newbie


          Can you check whether there is any call to cache.stop() in the code? If you call stop() on cache or cacheContainer and try to access the cache, you will get this error.


          If the cache is part of web application, make sure to call cacheContainer.stop() while un-deploying the webapp.

          • 2. Re: cache is Terminiated for unknown reasons
            dex chen Novice

            Thanks Pisa. I'll look into this.


            A related question about start/stop cahces:  Do I need to call start() on cache manager first to call startCache(s) for named caches?  Or do I need to call startCache(s) after call start() on cacheManager?  Right now, it seems that calling start() on cacheManager is not required if startCache() method is called.

            • 3. Re: cache is Terminiated for unknown reasons
              Galder Zamarreño Master

              It's best if you call start() on the cache manager first, or you create the cache manager with a constructor which already starts the cache manager (maybe you already do this...)

              • 4. Re: cache is Terminiated for unknown reasons
                dex chen Novice

                Galder, thanks for the response.


                I am trying to use start() on cacheManager right now.


                It seems that the method startCaches( String ...) may have potential issues when you have many named caches configured. The issue ("Unable to aquire lock..) I ran into may be related to this method. I used the startCaches( ..) in my earlier code. 


                Right now, what I am doing is that I create a DefaultCacheManager, and call start() on the cacheManager.  I do not call startCache() or startCaches() on named caches, since all defined caches in the same cache manager have the same life cycle. 

                I am testing these changes now.

                Do you see any problems?

                • 5. Re: cache is Terminiated for unknown reasons
                  Galder Zamarreño Master

                  No, that shouldn't be a problem. startCaches() is just a way to start caches in advance, but you can get the same effect calling getCache() on each cache when necessary.


                  I'm interested though in the "Unable to aquire lock.." issue. Do you have a unit test for this?

                  • 6. Re: cache is Terminiated for unknown reasons
                    dex chen Novice

                    No, I do not have a unit test to recreat "Unable to acquire lock" yet.  I'll try to create one. Right now, I ran into many other issues (as posted separately), and try to work around of them. I am thinking the startCaches(list of cache names) method behaves differently. The code seems putting starting each cache in a separate thread. thanks.