Open sathishkumar08082001 opened 7 months ago
The first thing that springs to mind here is some kind of issue with either not shutting the cache down properly, or with the logic that detects this. There have been improvements to the "dirty shutdown" detection logic recently but they're not in any official release yet. As a quick fix you could try using one of the internal releases available via the Terracotta Maven repository to see if that solves the problem: https://mvnrepository.com/artifact/org.ehcache/ehcache/3.10.9-internal17
If not we're probably going to need more information about how the cache is lifecycled, when is it shutdown, when is it created, and could anything else be messing with the contents of the persistence directory other than Ehcache.
Thank you so much for your valuable comments, chris. Let me once again look in to my cache shutdown flow. Other than shut logic, is there any possibilities of this issue related to cache configuration. If so, Please suggest me the better cache configuration.
Hello Chris, My previous was resolved by rectifying the control flow. Now facing the new issue,
org.ehcache.spi.resilience.StoreAccessException: java.lang.RuntimeException: java.io.EOFException at org.ehcache.core.EhcacheBase$CacheEntryIterator.advance(EhcacheBase.java:741) ~[ehcache-3.10.8.jar:3.10.8] at org.ehcache.core.EhcacheBase$CacheEntryIterator.next(EhcacheBase.java:765) [ehcache-3.10.8.jar:3.10.8] at org.ehcache.core.EhcacheBase$CacheEntryIterator.next(EhcacheBase.java:719) [ehcache-3.10.8.jar:3.10.8] at mypackage.DiskCache.getAll(DiskCache.java:86)
Caused by: java.lang.RuntimeException: java.io.EOFException
at org.ehcache.shadow.org.terracotta.offheapstore.disk.storage.FileBackedStorageEngine$FileChunk.readBuffer(FileBackedStorageEngine.java:574) ~[ehcache-3.10.8.jar:3.10.8]
at org.ehcache.shadow.org.terracotta.offheapstore.disk.storage.FileBackedStorageEngine$FileChunk.readKeyBuffer(FileBackedStorageEngine.java:507) ~[ehcache-3.10.8.jar:3.10.8]
at org.ehcache.shadow.org.terracotta.offheapstore.disk.storage.FileBackedStorageEngine.readKeyBuffer(FileBackedStorageEngine.java:265) ~[ehcache-3.10.8.jar:3.10.8]
at org.ehcache.shadow.org.terracotta.offheapstore.storage.PortabilityBasedStorageEngine.readKey(PortabilityBasedStorageEngine.java:119) ~[ehcache-3.10.8.jar:3.10.8]
at org.ehcache.shadow.org.terracotta.offheapstore.OffHeapHashMap$DirectEntry.
For, DiskCache.java public Map<K,V> getAll(){ initCache(); Map<K,V> values= new HashMap<>(); Iterator iterator = cache.iterator(); while (iterator.hasNext()) { Entry<K, V> entry = (Cache.Entry) iterator.next(); //line 86 values.put(entry.getKey(), entry.getValue()); } return values; } - Please help me to resolve the issue
Here is my configuration
Find the stack trace below,
The data is being stored in cache directory. When i try to iterate over the data , the above issue reproduces, but not always. Once i faced this issue, I have manually deleted the cached data from cache directory. Again i have executed the same code,, the data is loaded in to disk and used iterator,, then its working fine... Hence this issue is not reproducing always.. Please help me with the solution as soon as possible.