EHC ❯ getKeys() sometimes returns an incomplete list of keys
-
Bug
-
Status: Open
-
3 Minor
-
Resolution:
-
ehcache-core
-
-
dwithers
-
Reporter: dwithers
-
July 12, 2012
-
0
-
Watchers: 6
-
April 10, 2013
-
Attachments
Description
We are using several singleton caches to hold various objects, and we’re using disk overflow caching as well. What we see is that sometimes, the code can get an element from the cache, and then immediately find that getKeys() returns an incomplete list. That is, it doesn’t contain the key we just used to find the element. Expired or evicted, you say? No…cache.isKeyInCache() returns true after the call to getKeys(). If we disable disk overflow caching, this problem goes away.
Attached is a segment of the log with ehcache logging dialed up. It basically shows where we have a cache hit, and read an element from the cache. Immediately following that, getKeys() returns a list not containing our key.
Here is our cache.xml file (partial):
Code:
David,
This certainly looks strange, I can’t see or think of anything that could be causing this off the top of my head, and I’ve spent some time reviewing the code around this area and can’t see anything obviously suspicious. If you are able to provide us with a reproducible test case then that would be great. If that’s not possible or practical then a detailed description of what your application does to the cache would be the next best thing. The sort of detail I’m thinking of is:
- How many threads access the cache concurrently.
- What operations are the various threads performing.
- Are you doing anything out of the ordinary like mutating the configuration at runtime?
Thanks,
Chris
Can you take a quick look and give your opinion?