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

losing application variables in CF8

New Here ,
Dec 09, 2010 Dec 09, 2010

I have the following issue. My  application has a single application.cfc (no application.cfm).  Application variables are consistently "disappearing," i.e., becoming  undefined. This is generating runtime errors after minimal user  activity. If the server is rebooted, the variables persist for a very  short time (a few minutes) and then are undefined again.At what time the  variables "disappear" appears to be random.

The server is a ColdFusion  Enterprise server (CF 8).

Does  anyone know why application variables would suddenly go from being  defined to undefined within the same user visit? Is there any "side  effect" of built-in CF functions or tags which could cause this behavior  unexpectedly?

Thanks.

1.9K
Translate
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
Engaged ,
Dec 09, 2010 Dec 09, 2010

Do you have an application name that is also used by another website on the

same server perhaps? Try making it very unique.

Translate
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
New Here ,
Dec 09, 2010 Dec 09, 2010

Good idea, but this is the ONLY application on the server. And the name is very unique. Any other ideas? Also, even when usage is restricted to is restricted to a single user, the issue arises.

Translate
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
Contributor ,
Dec 09, 2010 Dec 09, 2010

Could you be setting application variables outside of the Application.cfc and the application times out?  If so the variable will become undefined until the other template runs and sets it.  What is your app timeout?  How heavily trafficed is the app?

Translate
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
New Here ,
Dec 09, 2010 Dec 09, 2010

Right now, essentially only a few internal users, really only one. So it's not heavy traffic at all. The issue happens even with only a single user.

We are creating/defining some application variables outside of the Application.cfc. But we are not undefining any Application variables outside of the CFC. We add application variables dynamically by defining a struct in the application and adding variables to that struct. This is standard practice and has never caused a problem before.

Our app timeout is 24 hrs. The application scope will last that long.

Thanks!

Translate
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
Contributor ,
Dec 09, 2010 Dec 09, 2010

So you're saying the app never times out?  Just making sure I understand you.

I'm thinking of a situation like this:

pageOne.cfm

--sets application.foo = 'something'

pageTwo.cfm

--outputs #application.foo#

application times out, first user after timeout hits pageTwo.cfm first thing in the day, application.foo is undefined.

Typically if I am setting application variables outside of the Application.cfc I at least make sure the onApplicationStart() method sets the value first to an empty value (string, struct, array, whatever) so that I know it will at least exist elsewhere.

Translate
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
New Here ,
Dec 09, 2010 Dec 09, 2010

I am saying the application scope will last 24 hours, at which time it will reset. That is the server setting. So for all practical purposes, you are correct: it will not (and is not) resetting.

The scenario you describe below is not happening. What's happening is a variable is defined in application one moment and not the next. Not just one variable---but all of them. We're losing the application scope variables. This is happening for all app vars, including ones we intialize in the application.cfc.

Translate
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
Valorous Hero ,
Dec 09, 2010 Dec 09, 2010

ashtonwilkins wrote:

That is the server setting.

You are aware that the server setting CAN be overridden in CODE. with either a <cfapplication applicationTimeout...> tag or a this.appliationTimeout= in an Application.cfc file psedudo constructor.

Have you confirmed one of these where not dropped somewhere in the code?

Translate
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
New Here ,
Dec 09, 2010 Dec 09, 2010

Yes, aware, and no, we're not changing it in code.

Translate
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
Engaged ,
Dec 09, 2010 Dec 09, 2010

Create an app variable called NOW with date of current date time. Then view

the app var after issue happens. See if / when app is resetting.

Translate
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
New Here ,
Dec 09, 2010 Dec 09, 2010

I'm working on a sophisticated-enough way to do this very thing. I did some manual dumps and can find when they disappear in this sense: it is always on a POST, and I can use an if statement to identify when they're gone. But it's random in the sense that they sometimes persist throughout a few more posts than at other times. Also, they do not always disappear on the same page. It truly appears to be random.

I'm pretty sure (99.9%) that the server is not getting rebooted. But putting logging in the applicationend is a good idea.

Translate
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
LEGEND ,
Dec 10, 2010 Dec 10, 2010
LATEST

Is it •any• application-scoped vars that could vanish, or always specific ones?

Are the application-scoped vars all set in onApplicationStart(), or could they be set elsewhere in the code?

Perhaps put a entry in OnApplicationStart() to check it's only getting run when you •think• it's getting run...

--

Adam

Translate
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
LEGEND ,
Dec 09, 2010 Dec 09, 2010

In short: nope.

Do you any stray Application.cf(c|m) files around?

Are you doing some sort of "variable clearance" that might not consider "pass by reference" issues, or something?

Hard to tell.

--

Adam

Translate
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
New Here ,
Dec 09, 2010 Dec 09, 2010

There is only one application.cfc. No other application.* file. We did a search of all directories.

I don't understand the second question about variable clearance, but if you mean this: (1) we have a struct; (2) we pass it to a function; (3) the function clears it, then no, that's not happening. I understand struct's are passed as references in CF, so we aren't doing that. We never clear out the application struct.

Translate
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
Contributor ,
Dec 09, 2010 Dec 09, 2010

And you're absolutely certain that the server isn't crashing/restarting without your knowledge?  I'd try Josh's suggestion.  I'd also put some logging in onApplicationEnd.  I'd also check my application/exception/server logs.

Translate
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
New Here ,
Dec 09, 2010 Dec 09, 2010

Good idea, I will do this.

Translate
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
LEGEND ,
Dec 09, 2010 Dec 09, 2010

It sounds like you •do• understand what I meant by the reference thing. In that light: I just have to shrug. Sorry.

--

Ada

Translate
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
LEGEND ,
Dec 09, 2010 Dec 09, 2010

I'm assuming this is not a clustered environment?


Translate
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