0 Replies Latest reply on Aug 26, 2016 5:26 PM by Elias Ross

    Cache loading and corrupted caches

    Elias Ross Master

      I've had a few cases where the server was shut down or crashed before writing complete data records.

       

      When the server is restarted, certain records are invalid and I see an errors at startup such as:

      Caused by: org.infinispan.commons.CacheException: Unable to start cache loaders

      at org.infinispan.persistence.manager.PersistenceManagerImpl.start(PersistenceManagerImpl.java:174) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]

      at sun.reflect.GeneratedMethodAccessor79.invoke(Unknown Source) ~[na:na]

      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_92]

      at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_92]

      at org.infinispan.commons.util.ReflectionUtil.invokeAccessibly(ReflectionUtil.java:168) ~[org.infinispan-infinispan-commons-8.2.2.Final.jar:8.2.2.Final] ... 69 common frames omitted Caused by: org.infinispan.persistence.spi.PersistenceException: org.infinispan.persistence.spi.PersistenceException: ISPN000279: Failed to read stored entries from file. Error in file xxx.dat

      at offset 4

      at org.infinispan.persistence.file.SingleFileStore.start(SingleFileStore.java:135) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]

      at org.infinispan.persistence.manager.PersistenceManagerImpl.start(PersistenceManagerImpl.java:144) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final] ... 73 common frames omitted Caused by: org.infinispan.persistence.spi.PersistenceException: ISPN000279: Failed to read stored entries from file. Error in file xxx.dat at

      at offset 4

      at org.infinispan.persistence.file.SingleFileStore.rebuildIndex(SingleFileStore.java:195) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]

      at org.infinispan.persistence.file.SingleFileStore.start(SingleFileStore.java:126) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final] ... 74 common frames omitted

      If it's gone bad, I want to basically clear the cache at this point.

       

      Or at runtime when fetching/updating an entry, I have seen this:

      java.io.IOException: Unsupported protocol version 0 org.infinispan.persistence.spi.PersistenceException: java.io.IOException: Unsupported protocol version 0

      at org.infinispan.marshall.core.MarshalledEntryImpl.unmarshall(MarshalledEntryImpl.java:116) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]

      at org.infinispan.marshall.core.MarshalledEntryImpl.getMetadata(MarshalledEntryImpl.java:72) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]

      at org.infinispan.persistence.PersistenceUtil.loadAndCheckExpiration(PersistenceUtil.java:120) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]

      at org.infinispan.persistence.PersistenceUtil.lambda$loadAndStoreInDataContainer$0(PersistenceUtil.java:98) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]

      at org.infinispan.container.DefaultDataContainer.lambda$compute$3(DefaultDataContainer.java:325) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]

      at org.infinispan.commons.util.concurrent.jdk8backported.BoundedEquivalentConcurrentHashMapV8.compute(BoundedEquivalentConcurrentHashMapV8.java:3548) ~[org.infinispan-infinispan-commons-8.2.2.Final.jar:8.2.2.Final]

      at org.infinispan.container.DefaultDataContainer.compute(DefaultDataContainer.java:324) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]

      at org.infinispan.persistence.PersistenceUtil.loadAndStoreInDataContainer(PersistenceUtil.java:91) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]

      at org.infinispan.interceptors.CacheLoaderInterceptor.loadInContext(CacheLoaderInterceptor.java:371) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]

      at org.infinispan.interceptors.CacheLoaderInterceptor.loadIfNeeded(CacheLoaderInterceptor.java:366) ~[org.infinispan-infinispan-core-8.2.2.Final.jar:8.2.2.Final]

       

       

      So there's two fixes. One is simply catch the exception in SingleFileStore and simply 'start fresh' in this case. The other is either replace the existing cache loader interceptor, or patch it to do the things I want it to. Meaning, by configuration, throw out any cache entry that fails to load, with maybe an option to get notification and/or log a warning.

       

      Is this a feature that makes sense for a more general audience?