Copy link to clipboard
Copied
I am running into the following scenario: Page 1 includes page 2, on both pages a session variable is returned to the screen. On occasions, page 2 throws an error on the session variable even though it was successfully called on page 1.
It only happens occassionally, and is very difficult to recreate in order to debug it in realtime. Has anyone run into something like this before? Thanks!
Copy link to clipboard
Copied
Same general idea but different details. It happens when the user is running the same application in different browser windows or tabs. It's all the same session so on occasion activity in Window B overwrites session variables written in Window A.
Copy link to clipboard
Copied
Sounds like you need to use cflock to prevent multiple requests from accessing those variables at the same time.
Copy link to clipboard
Copied
semi star gazer wrote:
I am running into the following scenario: Page 1 includes page 2, on both pages a session variable is returned to the screen. On occasions, page 2 throws an error on the session variable even though it was successfully called on page 1.
It only happens occassionally, and is very difficult to recreate in order to debug it in realtime. Has anyone run into something like this before? Thanks!
I suspect it has less to do with page-inclusion, more to do with the code on page 2. Suppose, instead of using cfinclude, you had copied the code from page 2 into page 1, and made 1 page of it. Then the error would still have occurred. That's at least my theory.
Have a look at how the code in page 2 handles the session. There is bound to be something not quite right about it. What kind of error do you get anyway?
Runtime debugging can be as simple as this:
<cftry>
<cfinclude template="page2.cfm">
<cfcatch type="any">
<cfdump var="#cfcatch#"><cfabort>
</cfcatch>
<cftry>
Copy link to clipboard
Copied
Regarding:
I suspect it has less to do with page-inclusion, more to do with the code on page 2
I share that suspicion. The scenario in the OP is different than what I described earlier. Given that the problem appears to be intermittent, I suspect that something is happening to the variable, inside some conditional logic code.