• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CF 2023 caching query

Participant ,
Oct 27, 2024 Oct 27, 2024

Copy link to clipboard

Copied

Hi,

We are testing upgrading from CF2018 to 2023 and have noticed some odd behaviour when saving forms over and over. We have a form which updates a table in the database and when updating the values a number of times in a short space of time the values on the screen aren't matching whats in the database. The values save fine to database but when they reload the form it should have the saved values which are called via a query at the top of the page. I assume this is some caching but I havent specified any caching in the query and haven't changed anything in the Coldfusion Administrator in caching section. Its all just default values there. I've tested it on CF2018 and I can save and save and everything reloads as expected. I can understand how this may happen if I used 'cachedWithin' in the query object as the query is the same each time but it should return something different each time as we are saving the form and updating the values for that table. Anyone noticed anything similair before?

 

Thanks

TOPICS
Advanced techniques , Server administration

Views

326

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 27, 2024 Oct 27, 2024

Copy link to clipboard

Copied

Hi @paulm1677332 , it does indeed look like a caching issue. In any case, what or whom do you mean by "they" in the statement, " ... when they reload the form it should have the saved values which are called via a query at the top of the page" ? The process of course depends on how the form is refilled and re-submitted. For example, does a user refill the form, then press the submit button?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 27, 2024 Oct 27, 2024

Copy link to clipboard

Copied

Hi @BKBK The form actually submits to itself with logic at the top to determine if it's been submitted. Below this then in the code is the 'get' which would query the db for values needed in the form. I forgot to mention that I was able to go out of the form to another page then back to it and still same old values displaying but values in the db were correct. Only when I logged out and back in again and loaded the form did it have the updated values.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 27, 2024 Oct 27, 2024

Copy link to clipboard

Copied

Just for more context. This is running via latest 2023 image from docker in AWS. I've been playing around with other pages too and seeing more query related issues. I have various counts against items on the homepage (counts returned via db query) I made changes there which should see one of those values increase each time which it did. So originally the count was 0 but I added 2 items and each time the counter displayed went up to 2 as expected. Then I added a third and value stayed at 2. Refreshed a number of times and then it went to 0! Then refreshed again and went back to 2. Eventually after going into another page and back again a couple of times it went to 3. No consistency to whats coming back from the query. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 27, 2024 Oct 27, 2024

Copy link to clipboard

Copied

Browser cache, perhaps? If not, then something may be clashing in the flow of the code or in the update of a scoped or complex variable. Difficult to say without seeing the code.

Can you share the code? If it contains sensitive information, you can share it by private message.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 27, 2024 Oct 27, 2024

Copy link to clipboard

Copied

Unlikley browser cache as i've repeated same steps on 2018 version without an issue on same browser. I'd rather not post code here but I can send you a PM with some.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Oct 27, 2024 Oct 27, 2024

Copy link to clipboard

Copied

It looked like my message kept failing but it didnt highlight anything and then I got a message saying my message quota had been reached for the day so maybe it went @BKBK ?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 29, 2024 Oct 29, 2024

Copy link to clipboard

Copied

Did the suggestion I gave in our e-mail correspondence work?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 28, 2024 Oct 28, 2024

Copy link to clipboard

Copied

The fact that the issue isn't repeated on CF2018 is a strong point. With many more eyes on the code, we should be able to see why. So, yes, send me a snippet of the relevant code by Private Message.

(Did you attempt to send already? I haven't received any message from you.)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 28, 2024 Oct 28, 2024

Copy link to clipboard

Copied

I have just messaged you my e-mail, in case you're having trouble sending me a Private Message

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2024 Nov 03, 2024

Copy link to clipboard

Copied

Hi @paulm1677332 ,

Is the problem solved? If so, could you please share the solution with the forum? 

This is the kind of issue that fellow developers will likely encounter.

You and I have discussed the issue and exchanged ideas by e-mail.
For the sake of sharing knowledge in the forum, here are some of the suggestions I gave you.

 

  1.  The query that obtains the form data is in a cfinclude. Test by moving the cfinclude into the form scope:
    <!--- Not your real code, but illustration --->
    <cfif isDefined("Form.submit")>
         <cfinclude template="getFormDataFromDB.cfm">
    </cfif>
    ​
  2.  Use a named lock for the parts of the code that contain queries to fetch data from, and to save data to, the database:
    <!--- Not your real code, just illustration --->
    <cfif isDefined("Form.submit")>
        <cflock timeout="30" name="dataProcessingLock" throwontimeout="true">
            <cfinclude template="saveFormDataToDB.cfm">
        </cflock>   
    </cfif>
    
    <cflock timeout="30" name="dataProcessingLock" throwontimeout="true">
        <cfinclude template="getFormDataFromDB.cfm">
    </cflock>
    ​
  3.  A loop in the code identifies the variables from a query as queryName.columnName. That may indeed be the intention. However, this implicitly assumes one of two things: the query contains just one row or only the first row is relevant. 

    To be sure, test as follows:
    (a) Do a debug dump of the query (using <cfdump var="#queryName#" abort="yes">) just before the loop;
    (b) Add an appropriate row number to the variables in the loop, where necessary. For example,  queryName.columnName[queryName.recordcount].

  4.  There is actually no form present on the page. Instead, the form fields are contained within a custom tag, <cf_form></cf_form>. Hence my suggestion: temporarily replace <cf_form></cf_form> with <form></form>, and see whether the issue goes away.

     

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 29, 2024 Oct 29, 2024

Copy link to clipboard

Copied

You should enable debug output for both environments. See what's going on behind the scenes in each. This might help you post useful code snippets and CF administrator settings.

 

Dave Watts, Eidolon LLC

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 03, 2024 Nov 03, 2024

Copy link to clipboard

Copied

LATEST

I realize this is a few days after your original question, but assuming the problem remains (and beyond the ideas shared so far by bkbk and Dave), I want to turn our attention to your presumption that this a "cf2023" problem. Until you can offer a test case that allows us to prove that ourselves (between our own cf2018 and cf2023), I have a different question.

 

You say your cf2023 is on docker on aws. What's your cf2018 setup? Is it also a docker image? (Adobe did offer docker images for cf2018 originally.) Either way, it at least also on aws? (There could be some facet unique to that which would not happen otherwise.) Is the OS st least the same between the two cf instances (I don't expect that should change how the features work. I'm just helping consider possibilities.) 

 

Indeed, are both cf instances talking to exactly the same database, and using the same driver type in cf? And what are your update levels for cf2023 and 2018? In particular, are you testing cf2023 update 11, since that has dozens of bug fixes. (And yes, Adobe has released a container image with update 11 pre-installed which should make it easy for you to try.) 

 

I realize you may not want to "play 20 questions ". As I said, if you could offer some small example code (that is standalone and allows us to recreate your results) that could let us skip most of those considerations, if we could confirm it was SOLELY about cf2018 vs cf2023. Until then, perhaps these will help you find the cause of your different behavior. 


/Charlie (troubleshooter, carehart.org)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation