EHC ❯ improper iteration through ALL_CACHE_MANAGERS
-
Bug
-
Status: Closed
-
-
Resolution: Fixed
-
-
-
drb
-
Reporter: sourceforgetracker
-
September 21, 2009
-
0
-
Watchers: 0
-
September 22, 2009
-
September 22, 2009
Description
We get this exception sometimes:
[java] java.lang.IndexOutOfBoundsException: Index: 200, Size: 200,
[java] at java.util.ArrayList.RangeCheck(ArrayList.java:546)
[java] at java.util.ArrayList.get(ArrayList.java:321)
[java] at java.util.Collections$SynchronizedList.get(Collections.java:1820)
[java] at net.sf.ehcache.CacheManager.detectAndFixDiskStorePathConflict(CacheManager.java:306)
We are on an old version of ehcache, but I see the same bug in the latest release:
for (int i = 0; i < ALL_CACHE_MANAGERS.size(); i++) {
CacheManager cacheManager = (CacheManager) ALL_CACHE_MANAGERS.get(i);
If the cache is removed in another thread between those lines, then you get that exception.
Since the latest ehcache is a copyOnWrite list, then all iterating through should be done with iterators, and it will be safe. All calls of this:
ALL_CACHE_MANAGERS.get
should be changed…
Thanks! Sourceforge Ticket ID: 2835670 - Opened By: mchyzer - 11 Aug 2009 16:14 UTC
Comments
Sourceforge Tracker 2009-09-21
Fiona OShea 2009-09-22
Re-opening so that I can properly close out these issues and have correct Resolution status in Jira
Chris
Thanks. Done. Will be in 1.6.2.
Greg Comment by: gregluck - 23 Aug 2009 06:01 UTC