Solved

Cold Fusion Session Swapping

Posted on 2002-07-01
4
464 Views
Last Modified: 2013-12-24

I'm runnning into an interesting problem with CF session variables getting swapped by (I think) the server. If two users come in from the same IP (behind a firewall or NAT or whatever) within a minute of each other, they occasionally get the other person's session ID. Macromedia has a page on their site that gives a solution to this problem -- their solution being check and make sure the IP's are different.

Obviously, this doesn't work in this case, since we know the IP's are supposed to be the same.

Has anyone had any similar problems and found a way around them? Or can you point me to a site with more information on this topic than the Macromedia site? Thanks! :-)

Jaxman
0
Comment
Question by:jaxman
  • 2
  • 2
4 Comments
 
LVL 5

Expert Comment

by:Yog
ID: 7122773
are you using CFLOCK when setting and reading session variables, http://www.sys-con.com/coldfusion/article.cfm?id=135
0
 

Author Comment

by:jaxman
ID: 7123242
I'm going through and doing a thorough check on all the code, but I believe everything is locked down appropriately.

We've got a situation where we're using session.datasource to hold our DSN, and then at the top of application.cfm we're assigning it to request.appDSN so we can work with it in the request scope ever after instead of the session scope (to make locking easier to deal with).

Question: Will reading from a session variable (ie: putting session.datasource as an r-value of an operation) potentially cause corruption if not properly locked, or is it only when the session variables are l-values?


Jax
0
 
LVL 5

Accepted Solution

by:
Yog earned 200 total points
ID: 7123284
Jax,

yeah locking may require if you are not making a copy of it and using even for a Request scope. If you turn on (from CF Administrator) stricter checking it will tell you wheather the code is not behaving well or behaving well.

if you are using the Request scope, make sure you use the duplicate if you are making another copy of it and using, an "=" usage may just make a reference and wont help

eg.

<CFLOCK SCOPE="Application" TIMEOUT="10">
<CFSCRIPT>
  Request.Application = StructNew();
  Request.Application = Duplicate(Application);
</CFSCRIPT>
</CFLOCK>

<CFLOCK SCOPE="Session" TIMEOUT="10">
<CFSCRIPT>
  Request.Session = StructNew();
  Request.Session = Duplicate(Session);
</CFSCRIPT>
</CFLOCK>

This was suggested to me by pikala and it works good.

Yog
0
 

Author Comment

by:jaxman
ID: 7123302
I'll have to give that a try...you've given me some good pointers, its going to take a while to test them out (these non-deterministic problems are crazy to track down). Thanks for the info! :-)

Jax
0

Featured Post

New My Cloud Pro Series - organize everything!

With space to keep virtually everything, the My Cloud Pro Series offers your team the network storage to edit, save and share production files from anywhere with an internet connection. Compatible with both Mac and PC, you're able to protect your content regardless of OS.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now