Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

application variables disappearing

Status
Not open for further replies.

zma

Programmer
May 30, 2006
25
US
Once or twice a month, ColdFusion says our application variables (arrays) are undefined. Sometimes they are defined but will only have a null string or blank in the first array position and that is all. We are able to fix this when it happens but would like to prevent it.

Does anyone have any idea what is causing this?

We are running ColdFusion version MX6.1 and Windows 2003 Server with the webserver that comes with it.
 
It's easy and not a big problem.

Where are these appliCation variables created? Via a sched task? In one certain page? In application.cfm?

If its in a task, this take may be failing to run every once in a while... If its in one page then that page has gaps sometimes where it is not visited.. and if its via application.cfm then your site, or folder or whatever is not being visited for a space of time greater than the application timeout.

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
They are set in application.cfm which has no explicit timeout in it. Timeout in the Cold Fusion administrator is set to 180 days.
If a server variable called server.x is true, then server.x is set to false, code tables are queried, and arrays are assigned to these values. If server.x is false, application.cfm skips over all that. Everything runs fine until suddenly the application variables become undefined or are defined but have a 1,1 element that is either ' ' or ''. We set server.x to true when a new code is added to a table or when the application variables lose their definitions or values. The ColdFusion log files do not seem to show anything strange happenning just before.
 
It still seems that you're hitting some timeout, but the situation does sound strange...

This sounds like a job for cftry/cfcatch...

ALFII.com
---------------------
If this post answered or helped to answer your question, please reply with such so that forum members with a similar question will know to use this advice.
 
If you're using a global flag to indicate if all the variables are set, then I'd make that flag have the same scope as the variables it's responsible for by making it an application var.. something like:
Code:
<cfif not isdefined("application.x")>
<cfset application.var1="blah">
<cfset application.var2="asdf">
<cfset application.x=1>
</cfif>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top