tracker issue : CF-3369530

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

Frequent key collisions on cached queries resulting in wrong (cached) result-set returned

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): David Stockton / David Stockton (DaveyS)

Created: 11/21/2012

Components: Caching

Versions: 10.0

Failure Type: Data Corruption

Found In Build/Fixed In Build: Final / CF 10 Update 11

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Platforms All

Vote Count: 8

Problem Description:
A query can be requested in CF10 that is not cached. However, CF10 returns a previous query that is in the cache returning the incorrect data. The problem is in the way the cache key is generated for a cached query with queryparams. It's much too easy to generate a key collision.

Steps to Reproduce:
1 - Create the table & data as defined in comments at top of test.cfm (attached)
2 - Run test.cfm

Actual Result:
Query result for "RGB100" is returned in case 1, 2
Query result for "RAB160" is returned in case 3.

Expected Result:
Query result for "RGB100" is returned in case 1
Query result for "RAB160" is returned in case 2, 3.

Any Workarounds:
 - Don't cache the query
 - Don't use cfqueryparam
 - Add (SQL) comment containing all queryparam values to SQL text so it is unique but doesn't affect the query or query-plan

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

Watson Bug ID:	3369530

Keywords:
FixTested


External Customer Info:
External Company:  
External Customer Name: DaveyS
External Customer Email:  
External Test Config: Happens on CF10 (no updates) & CF10 update 5 on CentOS 6 64bit and Windows 7 64bit

Attachments:

  1. November 22, 2012 00:00:00: 1_test.cfm

Comments:

Note: It's much easier to get key collisions in CF10 than CF9 - this is why I think it's an important issue.
Comment by External U.
17128 | November 21, 2012 11:28:58 AM GMT
Can't use query caching due to this bug. Performance degrade unacceptable in production environment. Build-up of homepage slowed down from < 1s to > 6s.
Vote by External U.
17142 | December 05, 2012 03:58:03 AM GMT
I just got bit by this as well. This was a blow to my production server, as I need to heavily leverage cached queries to make this particular application perform.
Vote by External U.
17143 | December 27, 2012 11:26:08 AM GMT
One additional workaround is to roll your own unique ID and use the new "cacheID" attribute of CFQuery. I did this by making a struct of key/value pairs for the various SQL parameters, serializing it to JSON, then hashing it. Although I think adding the cfqueryparam values as a SQL comment is a bit cleaner to code.
Comment by External U.
17129 | December 27, 2012 11:28:46 AM GMT
By the way, I'm seeing this on CF10 update 6 64-bit on Windows 7 64-bit. Looks like it has been fixed in a yet-to-be-released build.
Comment by External U.
17130 | December 27, 2012 11:30:46 AM GMT
I'm still seeing this on the latest update 10, 64-bit on Windows 7 64-bit.
Comment by External U.
17131 | May 15, 2013 01:26:49 PM GMT
Encountered problem, waiting for fix.
Vote by External U.
17144 | July 29, 2013 05:15:57 PM GMT
We are still seeing this on a fully patched CF 10 server (64bit windows 08r2, Java 7, CF ent, standard install).
Vote by External U.
17145 | August 29, 2013 12:39:27 PM GMT
We have also been seeing this on our production servers, using cfstoredproc and cachedwithin. We've had to turn off most of the query caching due to incorrect data being returned for the cfprocparams being passed.
Comment by External U.
17132 | August 29, 2013 12:41:47 PM GMT
Serious issue for production servers to not be able to use caching!
Vote by External U.
17146 | August 29, 2013 12:42:40 PM GMT
This has forced us to remove a lot of the cached queries and is seriously slowing down our production site.
Vote by External U.
17147 | August 29, 2013 12:44:21 PM GMT
we have a client with multiple CF10 server under heavy load that is running into this issue and they are hitting this issue. https://bugbase.adobe.com/index.cfm?event=bug&id=CF-3600362 CF hangs on clearing query caches. So my thought is these two could be related. Take a high load environment - clear query caches - then have multiple threads (hundreds) trying to re-cache multiple queries. Does CF10 hang do to cache query keys starting to collide?
Vote by External U.
17148 | August 29, 2013 12:55:01 PM GMT
until it's fixed our ability to effectively use caching on ColdFusion 10 with cfqueryparam is hampered.
Vote by External U.
17149 | August 29, 2013 02:14:11 PM GMT
@MaryJo, This has been fixed in update 11 and I would strongly suggest you to move to this update.
Comment by Rupesh K.
17133 | August 29, 2013 11:29:03 PM GMT
We have ran the update 11 and tested again but we are still seeing this issue. I've suggested my client open a support ticket to get more direct support so we can get this resolved.
Comment by External U.
17134 | September 18, 2013 11:16:43 AM GMT
Why in heaven's name is this marked as closed Adobe? Did no one see all the comments below? This is STILL an issue. Please address it.
Comment by External U.
17135 | January 10, 2014 11:25:48 AM GMT
Just to add to my previous comment, we're using stored procedures and that is where we are seeing the problem. The data returned from our SPs when using caching is frequently wrong and makes it unable to use caching for the majority of our data. I haven't tested on the most recent builds but it was definitely still an issue after update 11.
Comment by External U.
17136 | January 10, 2014 02:55:26 PM GMT
Could someone at Adobe please tell us what build 283476 is? Will this be in a future CF10 update (it better be) or are we going to have to wait until CF11 (unacceptable, as this breaks previously working ColdFusion functionality in CF9 and previous)?
Comment by External U.
17137 | January 14, 2014 11:05:40 AM GMT
Adobe, hello? If someone asks you a question, it's courteous to actually reply to them :-| -- Adam
Comment by External U.
17138 | September 01, 2014 03:04:55 AM GMT
As we mentioned earlier, this was fixed in update 11. We are still not able to replicate this. We reached out to few users who said that the fix is not working for them but we have not been able to get any reproducible case from them. Could you please help us in replicating this issue so that we can investigate this?
Comment by Rupesh K.
17139 | September 12, 2014 12:27:31 AM GMT
Since we have not heard anything so far, we presume that the fix is working and hence closing this.
Comment by Vamseekrishna N.
17140 | November 11, 2014 04:00:40 AM GMT
This issue is fixed now and the fix for this issue will be available as part of upcoming updates of ColdFusion 2016, ColdFusion 11 and ColdFusion 10.
Comment by Nimit S.
17141 | October 25, 2016 01:37:01 AM GMT