Status: Resolved (View Workflow)
Affects Version/s: 8.2.4.Final
Fix Version/s: None
When using a size bounded cache with the LIRS eviction strategy and there are no cache hits, the cache will leak until OOM is triggered. This makes LIRS a risky choice for a bounded cache in which a large number of puts can occur before the arrival of a subsequent cache hit. At worst the application can go OOM, and at best it keeps working but suffers from randomly excessive heap usage.
See attached JUnit test class. There are 5 cases in the test:
- A size bounded cache using LRU with only puts does not leak. PASSES
- A size bounded cache using LIRS with only puts does leak. FAILS
- A size bounded cache using LIRS with intermittent cache hits does not leak. PASSES
- A size bounded cache using LIRS with intermittent cache misses does leak. FAILS
- A size bounded cache using LIRS with a single cache hit and subsequent intermittent cache misses does leak. FAILS
The test was written assuming Java 8 and Infinispan 8.2.4. It should be run using the -Xmx64m JVM argument to limit heap size. Each test method should be run separately. The FAILING tests will throw OOME or have very slow progress with excessive garbage collection. The PASSING tests will run quickly through 1,000,000 cache puts.