this is sort of correct.  with all deference to mr forta, a more accessible example of 
a race condition is one that ray camden uses.

if you have 

<CFSET APPLICATION.somevar = APPLICATION.somevar + 1>

in a script, multiple people may be executing this simultaneously.  this can be a Bad 
Thing(tm) sometimes.  when the users hit that line, you CANNOT depend that the 
variable has been incremented once for any given user.  some other user may have 
caused the increment.

christopher olive
cto, vp of web development, vp it security
atnet solutions, inc.
410.931.4092
http://www.atnetsolutions.com


-----Original Message-----
From: Tyler Silcox [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, May 01, 2002 7:15 PM
To: CF-Talk
Subject: Re: CF Wishlist


I believe race conditions are where you are setting a variable multiple
times per request or session, and your code relies on the changing value to
execute properly.  For example if you had:

<cfset session.MyCurrentStep=1>

<!--- then run some other code here then you increase the value of the
variable (in this page or another) --->

<cfset session.MyCurrentStep=session.MyCurrentStep + 1>

<!--- then you might have a cfif or cfswitch running off the
session.MyCurrentStep --->
<cfswitch...

You should put a lock around the incrementing section because your code
relies on whatever the value of session.MyCurrentStep currently is.  If you
do not use a cflock, there's always the possibilty that the variable could
be set multiple times and end being set to Step 3 if you really should only
be on Step 2.

I think this can only happen if you start to set the value of the variable
and the value is changed before you reach the right side of the equation and
it spits out an incorrect value.   (hmmm?)

Now, why and how this is a problem, I don't know.  If the code is going to
be run twice (when it isn't supposed to) then you are going to end up with a
wrong value for one,or both, of your pages anyways. So I still haven't
figured out where the hangups are with the tag itself, by this reasoning,
shouldn't we just lock the whole request?  Can anyone with a big brain
figure this out for us?  I've already went though this once on the Beta
forums, and everytime I think I have cflock licked, I start thinking about
it more and more and it starts making less and less sense.

Tyler Silcox
email | [EMAIL PROTECTED]

----- Original Message -----
From: "Paul Giesenhagen" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Wednesday, May 01, 2002 5:22 PM
Subject: Re: CF Wishlist


What is "race" conditions?

Paul Giesenhagen
QuillDesign
http://www.quilldesign.com
SiteDirector Commerce Builder



> You need to lock to prevent race conditions. If that is why you were
> locking then yes, you should.
>
> But you do not need to lock to prevent memory corruption. So, if that
> was the only reason you were locking, then no need.
>
>
>
> -----Original Message-----
> From: Raymond Camden [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, May 01, 2002 5:02 PM
> To: CF-Talk
> Subject: RE: CF Wishlist
>
>
> >
> > > From: "Raymond Camden" <[EMAIL PROTECTED]>
> > >
> > > cflock is _not_ necessary for memory issues anymore. You
> > still need it
> > > for logical reasons. For example:
> > >
> > > application.x = application.x + 1
> >
> > Whoah - not been following this thread closely, but did I miss
> > something? You don't need to habitually lock Session, Server and
> > Application variables anymore in CFMX?
> >
>
> Correct. But, it doesn't hurt either. I'll probably continue using it
> just to be safe.
>
> =======================================================================
> Raymond Camden, Principal Spectra Compliance Engineer for Macromedia
>
> Email    : [EMAIL PROTECTED]
> Yahoo IM : morpheus
>
> "My ally is the Force, and a powerful ally it is." - Yoda
>
>
>


______________________________________________________________________
Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to