Re: Locking Issue - Read value from APPLICATION scope write it to SESSION scope

2009-06-02 Thread Dave Watts
Acknowledged. My (admittedly conservative) approach is to prove that the app _doesn't_ need locking rather than the reverse. Don't get me wrong, I'm all in favour of eliminating both the extra coding burden as well as the overhead. That said, the docs seem to lean towards locking when in

Re: Locking Issue - Read value from APPLICATION scope write it to SESSION scope

2009-06-01 Thread Dave Watts
Having a brain cramp on this one guys... How would one approach locking when reading a value from the APPLICATION scope and subsequently writing it to the SESSION scope..? EXAMPLE -- cfset session.foo = application.bar It depends. What version of CF is this? Is there

re: Locking Issue - Read value from APPLICATION scope write it to SESSION scope

2009-06-01 Thread Jason Fisher
Assuming you're on CFMX 7 or 8, you no longer need to LOCK on READ, so if you're concerned about race conditions on the WRITE, just do: cflock scope=session type=EXCLUSIVE timeout=10 cfset session.foo = application.bar /cflock (timeout can be whatever is appropriate)

Re: Locking Issue - Read value from APPLICATION scope write it to SESSION scope

2009-06-01 Thread Scott Weikert
Is there any reason you can't simply lock the app scope, grab application variable and put it into a local variable, unlock, lock session, copy from local var to session var, unlock? ~| Want to reach the ColdFusion community

Re: Locking Issue - Read value from APPLICATION scope write it to SESSION scope

2009-06-01 Thread Jason Fisher
That would work, but it's unnecessary overhead unless you're still on CF 5. Virtually all that locking has been handled in MX. ~| Want to reach the ColdFusion community with something they want? Let them know on the House

Re: Locking Issue - Read value from APPLICATION scope write it to SESSION scope

2009-06-01 Thread Dave Watts
That would work, but it's unnecessary overhead unless you're still on CF 5.  Virtually all that locking has been handled in MX. Well, no, that's actually not correct. CF doesn't lock variables unless you use CFLOCK. It simply doesn't crash if you don't lock them, as it used to with CF 5 and

Re: Locking Issue - Read value from APPLICATION scope write it to SESSION scope

2009-06-01 Thread Jay Greer
@Dave What version of CF is this? CF-8.1 Is there any likelihood of a race condition with Application.bar? It's possible, yes. If there is the likelihood of a race condition with that variable, do I care? That is, could the race condition cause an improper value of any significance?

Re: Locking Issue - Read value from APPLICATION scope write it to SESSION scope

2009-06-01 Thread Jay Greer
@Jason Assuming you're on CFMX 7 or 8, you no longer need to LOCK on READ... Well that's debatable for sure... http://www.horwith.com/index.cfm/2008/4/28/cflock-explained http://www.horwith.com/index.cfm/2008/7/17/CFLOCK-further-explained

Re: Locking Issue - Read value from APPLICATION scope write it to SESSION scope

2009-06-01 Thread Dave Watts
On Mon, Jun 1, 2009 at 16:59, Jay Greer m...@gobluerocket.com wrote: @Dave What version of CF is this? CF-8.1 Is there any likelihood of a race condition with Application.bar? It's possible, yes. If there is the likelihood of a race condition with that variable, do I care? That is,

Re: Locking Issue - Read value from APPLICATION scope write it to SESSION scope

2009-06-01 Thread Jay Greer
Then lock the application scope with a read-only lock, copy the value into a local variable, then lock the session scope with an exclusive lock, then copy the local variable into the session. Roger that... Thanks, Dave all.

Re: Locking Issue - Read value from APPLICATION scope write it to SESSION scope

2009-06-01 Thread Jason Fisher
@Jay Yes, fair enough. Granted that CF doesn't guarantee the order of execution when processing threads in a request, does the application in this case really have the possibility of having multiple threads making sequential changes to that specific session variable (which is thread-safe to

Re: Locking Issue - Read value from APPLICATION scope write it to SESSION scope

2009-06-01 Thread Jay Greer
@ Jason Are there Ajax or iframe calls or something that could be making updates to that session var for that user at the same time in a situation where the order of execution could cause an unexpected value to be read back out by the server? Yup... To me, it just seems that you almost