> I've noticed that one of my users was causing errors in my application 
> because he opens several windows to work in different areas of the system in 
> the same time. This causes conflicts in the session scope, since all of his 
> windows are having the same cookie, therefore the same session.
>
> This person is now aware of the problem and is not using several windows 
> anymore, but just out of cutiosity, does any one see how I could detect
> such behavior?

This is pretty common - I see people doing it all the time.

You can prevent session-based race conditions by using CFLOCK around
any code that reads or writes session variables, where (a) a race
condition might occur, and (b) you actually care about the outcome of
that race condition - for example, if the user causes two database
queries to fetch data rather than one, but the data is the same in
both queries, you don't care about the outcome.

You can create an identifier in the session scope that corresponds to
a specific browser instance - setting the value initially on the first
page load, for example - and making sure that token is passed back on
each page request and that it matches the stored value. But if you
simply use CFLOCK, you probably don't need to bother with this.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353027
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to