tracker issue : CF-3946143

select a category, or use search below
(searches all categories and all time range)
Title:

Cache already exists error

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Stephen Baker / Stephen Baker (Stephen Baker)

Created: 02/27/2015

Components: Caching

Versions: 10.0

Failure Type: Crash

Found In Build/Fixed In Build: Final / 299865

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Win 2008 Server R2 64 bit

Vote Count: 3

Listed in the version 2016.0.03.300466 Issues Fixed doc
Problem Description:
When running cfcache on a site with a lot of concurrent traffic, it occasionally fails with an exception.
See other people's experience with the error at http://stackoverflow.com/questions/27412484/cache-already-exists-error-with-cfcache

Steps to Reproduce:
There is a code sample on the linked stackoverflow page.  In my case I had cfcache surrounding a code block, with memory storage.
Concurrent execution of the page is required.  The problem is a race condition so it's not always easy to produce.

Actual Result:
Message 	Cache erms_vuiTEMPLATE already exists 
StackTrace 	net.sf.ehcache.ObjectExistsException: Cache erms_vuiTEMPLATE already exists at net.sf.ehcache.CacheManager.addCache(CacheManager.java:1171) at coldfusion.tagext.io.cache.ehcache.GenericEhcache.createCache(GenericEhcache.java:516) at 
... (snipped for character count limit)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) 

Expected Result:
Either there should be 1 cache miss and the other execution waits for the cache to be filled in, or two cache misses and both generate the content but only one is stored.  Either way no crash.


Any Workarounds:
Surround <CFCACHE> with <CFLOCK type="exclusive">.  Obviously this is heavy handed and harms performance more than necessary on multicore machines.

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3946143

External Customer Info:
External Company:  
External Customer Name: Stephen
External Customer Email:  
External Test Config: My Hardware and Environment details:

ColdFusion 10 Enterprise update 15.

Windows 2008 R2 64bit

Attachments:

  1. September 29, 2015 00:00:00: 1_2015-04-14-2300-web_server_fetches_only.txt

Comments:

Please provide code snippet to repro the case. The sample code provided in the above mentioned link is not sufficient. Thanks.
Comment by Akhila K.
8230 | April 15, 2015 11:48:47 AM GMT
Did you read the Stack Overflow article? They said the issue was obvious in the source code for coldfusion.tagext.io.cache.ehcache.GenericEhcache. Anyway, any CFCACHE I have tried can reproduce it but the page must have high concurrent load because it is a race condition. If you insist on an example: <CFCACHE action="cache" stripWhiteSpace="true" timespan=".25" useQueryString="true" id="mycache"> <CFSET Sleep(100)> <CFDUMP var="#url#"> </CFCACHE>
Comment by External U.
8231 | April 15, 2015 12:55:20 PM GMT
Hi Stephen, I have tried the same example what you have provided below with some load , but didn't able to reproduce the issue . Can you please let us know the approximate load you have tried so that we can repro with the same ?
Comment by Mukesh K.
8232 | September 29, 2015 05:09:57 AM GMT
I've attached a sample log of the sort of load that the web servers are experiencing. The CFThread Pool Size is 10. It is worth noting that this is a rare race condition. Even under this sort of load, we only experienced the issue every few weeks.
Comment by External U.
8233 | September 29, 2015 08:22:58 AM GMT
subscribing ......................
Vote by External U.
8241 | September 30, 2015 02:38:06 AM GMT
I'm getting this error too Cache iSearch-BFS already exists
Vote by External U.
8242 | December 04, 2015 09:42:57 AM GMT
I'm getting this error too Cache iSearch-BFS already exists CF11 update 7 Win 2012 x64
Comment by External U.
8234 | December 04, 2015 09:44:05 AM GMT
I am experiencing the same bug with CF 11.
Comment by External U.
8235 | May 07, 2016 08:52:25 AM GMT
Able to repo this on CF11 update 9. Marking this as ToFix
Comment by Poonam J.
8236 | July 12, 2016 01:22:15 AM GMT
code snippet: <cfloop index='i' from ="1" to="100"> <cfthread action="run" name="t#i#"> <CFCACHE action="cache" stripWhiteSpace="true" timespan=".25" useQueryString="true" id="mycache"> <CFSET Sleep(1)> <CFDUMP var="dfdfdd"> </CFCACHE> </cfthread> </cfloop>
Comment by Poonam J.
8237 | July 12, 2016 01:22:28 AM GMT
Some exception are getting generated. PFA.
Comment by Poonam J.
8238 | August 09, 2016 05:45:52 AM GMT
This Exception is not related & not related to this fix as well. Nimit raised this bug with Hima You can test it after nimit verifies it or till the time you can keep the status as totest hasdependecy
Comment by S V.
8239 | August 09, 2016 05:51:11 AM GMT
We ended up giving up on CFCACHE and instead using REDIS. It works great and I'd recommend as CFCACHE is not stable. There is a nice CFC for REDIS here: https://github.com/MWers/cfredis
Comment by External U.
8240 | August 09, 2016 10:49:05 PM GMT