Solved

Cold Fusion Session Swapping

Posted on 2002-07-01
4
466 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 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