0

Using Coldfusion 8, Coldbox 2.6.3.

Storing query object in session. Session is set asynchronously and attempted to be read from 'instantly' in a popup window to generate excel sheet/csv. Initial error of garbage data in the generated file fixed with 'cflock' on setting/reading session code chunks(session scope). Same session var is set in multiple places to different queries. New error is that the session var is just set to the previous query it was set to and not the one it should be set to. After waiting a few seconds and doing a refresh, session var has correct query.

A Coldfusion exception is generated in CF debugging that a certain query column is not defined - the column names being hardcoded to read from the query in session - which just means that the session var has the wrong query which I confirmed to be the previous query using cfdump.

I wonder why cflock would fix the garbage data problem but not this problem. Thanks.

miniparser
  • 107
  • 1
  • 6
  • 1
    I suggest that you use cachedwithin rather than the session scope to speed up production. We have been burned in that code that we wrote 10 years ago started giving bad results The reason is that modern browswers make it much more possible for users to change the session variables. One such way is with tabbed browswers. – Dan Bracuk Jan 24 '13 at 20:14
  • A simple case of query object not ready in the session yet? Maybe it'd be better if the request from the popup can prepare the query objects instead of relying on query object being readily available in session? – Henry Jan 24 '13 at 20:14
  • k thanks Henry. >.< *duh* on my behalf, kinda. it looks like the cflock was 'fixing' the garbage data i got in excel/csv for large data sets by just waiting for the query to get written to session, giving up and using the previous query before moving on to the other locked chunk of code to generate the clean output. case in point i had a query in the session with 16 records and then ran the call to populate session and generate the excel for a query with over 1000 records and it generated the excel for the 16. now i don't have to use cflock. – miniparser Jan 24 '13 at 21:59
  • i should add that i set the timeout in each cflock to 60 seconds, so that is not what was making it use the previous query. so cflock doesn't even really work when it comes to setting session variables within it. – miniparser Jan 24 '13 at 22:13

0 Answers0