I'm maintaining an old java code that is based on Infinispan 9.4.24 and terminates by an out of memory exception. The code launches 680 threads where each thread receives each second a 2byte data and inserts it in a cache. After one hour, the thread stoppes the cache with the stop method, and recreate a new cache for it. Unfortunately, after 2 or 3 hours of execution in a jvm of 1Gbyte, the code gets an outofmemory exception. I tried to use eviction configuration (see below) but it didn't solve the problem :
new ConfigurationBuilder().memory()
.storageType(StorageType.BINARY).evictionType(EvictionType.COUNT)
.evictionStrategy(EvictionStrategy.REMOVE).size(1000)
.persistence().addSingleFileStore().location(cachesRootLocation)
.purgeOnStartup(false).build();
I tried removing entries directly from the cache map, but it does'nt work, getting on exceptions like : I tried expiration and lifespan configuration, but it didn't work as i am not configuring cluster mode : .expiration() .lifespan(3600, TimeUnit.SECONDS)
I disabled passivation while using the evict method, but no solution.
Usually, i have an IllegalLifecycleStateException exception telling that cache is in stopping or terminated state, when using eviction and calling the evict method or remove map entries after or before stop.
Can anybody tells me if the stop method really removes cache entries from memory please ? Can anybody help me please ? How to remove entries from cache without getting exceptions ?
Using a profiler (jdump and MAT tools), i can see that most of memory is occupied by DefaultDataContainer instancies.
Thanks for your help.