tracker issue : CF-3335493

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

Caching issue

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/NotABug

Reporter/Name(from Bugbase): Raymond Camden / Raymond Camden (Raymond Camden)

Created: 09/22/2012

Components: REST Services

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: Final /

Priority/Frequency: Major / Some users will encounter

Locale/System: English / Mac 10.7 64-bit

Vote Count: 1

Ok, this could be very bad I think. Consider this simple REST cfc:

component rest="true" restPath="contentService2" {

   remote string function helloWorldSimple() httpmethod="get" produces="text/plain" {
      return "Content Simple";

   remote struct function helloWorldComplex() httpmethod="get" produces="text/xml,application/json" {
      var code = randRange(1,100);
      return {code:code, message:"Content Complex"};


I wrote a simple CFM to request this service, once asking for xml, once json:

<cfhttp url="http://localhost:8500/rest/cfwack5_root/contentService2">
   <cfhttpparam type="header" name="Accept" value="application/json" />
<cfdump var="#cfhttp.filecontent#">


<cfhttp url="http://localhost:8500/rest/cfwack5_root/contentService2">
   <cfhttpparam type="header" name="Accept" value="text/xml" />
<cfdump var="#cfhttp.filecontent#">

When run, the result was formatted right, ie JSON for the first one and XML for the second, but, crucially, the number was either the same, or one off. So I'd either get 5 and 5 for example or 5 and 4. Only once in about 30 reloads did I get two numbers that were very different.

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

Watson Bug ID:	3335493

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



Spoke to Rupesh.This issue has nothing to do with REST.If you have a randRange(1,100) in a simple cfm and run it using cfhttp tag like the example in repro you see the same behaviour.This could be due to caching in httpclient (yet to investigate). But we will not take this up for hotfix since it has nothing to do with REST.
Comment by Asha K.
18017 | October 22, 2012 05:17:24 AM GMT
Simple Repro case: ---------------------------------- Test.cfm ----------------- <cfoutput>#randRange(1,100)#</cfoutput> Test1.cfm --------------------- <cfhttp url="http://localhost:8500/CF10Unverified/CF-3335493/test.cfm"> </cfhttp> <cfdump var="#cfhttp.filecontent#"> <p> <cfhttp url="http://localhost:8500/CF10Unverified/CF-3335493/test.cfm"> </cfhttp> <cfdump var="#cfhttp.filecontent#"> Marking it to "ToFix".
Comment by HariKrishna K.
18018 | December 16, 2013 09:07:04 AM GMT
Ouch - that is pretty serious.
Comment by External U.
18019 | December 16, 2013 09:28:13 AM GMT
Not a vote, just subscribing. -- Adam
Vote by External U.
18023 | December 16, 2013 05:16:06 PM GMT
Odd - I'm not able to reproduce the simpler issue. Maybe that's a good thing.
Comment by External U.
18020 | December 17, 2013 06:21:16 AM GMT
Sequential HTTP calls to random function within less span of time resulting in same number. This issue nothing to do with caching. Use a psuedo-random algorithms (SHA1PRNG, IBMSecureRandom) to provide greater randomness.
Comment by S V.
18021 | March 06, 2014 06:28:06 AM GMT
Pass the psuedo-random algarithm parameter in the randRange(). Example: <cfoutput>#randRange(1,100,"IBMSecureRandom)")#</cfoutput>
Comment by HariKrishna K.
18022 | March 11, 2014 07:55:13 AM GMT