• Bug
  • Status: Resolved
  • 1 Critical
  • Resolution: Fixed
  • alexsnaps
  • Reporter: alexsnaps
  • February 08, 2013
  • 0
  • Watchers: 4
  • March 01, 2013
  • February 11, 2013


When evicting, we first select the victim, then we remove it. To do so, we eventually invoke remove(K, V) on CHMv8 passing the Element chosen as the victim as V. Now, you can’t compare Elements using equals as they return true if their keys are equal, which will always be true. What we really mean here is object identity equality actually.

CHMv8 should not try and do a valueToCompare.equals(entryValue) if valueToCompare is an Element instance.

This currently is racy in the HeapCachingTier, if the victim gets replaced before we get to remove it, we’ll remove it anyways…


Alexander Snaps 2013-02-08

I just checked MemoryStore and actually this race exists there too… So there is no _new_ bug here

Fiona OShea 2013-02-08

The fix will need to be in the following branches, Ehcache 4.0.0-RC Ehcache 2.7.x Ehcache trunk

Alexander Snaps 2013-02-11

Fixed to only do identity comparison on Element instance values r7088 on 4.0.0-rc branch (nowhere else to merge afaict)

Alexander Snaps 2013-02-11

oops, yes, 2.7.x probably : r7089