It's not necessary from a data corruption issue like it was in very old CF I forget the version number. It may or may not be necessary from a race condition standpoint but that is based entirely on what you are using them for.
I'd lean towards no, but bear in mind that if you are using frames or multiple ajax calls with counters or otherwise you could come unstuck.
Alex
Sent from my phone
When setting/getting session variables is it still necessary to cflock the process?
--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/ba1dd251-5e6c-46a0-98be-0e252306f273%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
lock scope="session" type="readonly" timeout=30 { // BTW, you may know this already, but this timeout is not that the code should take 30 seconds to run,
// it is, "wait 30 seconds trying to acquire the lock before throwing an exception."
session.key = "value";
}
lock scope="application" type="readonly" timeout=30 {
application.key = "value";
}
As I understand, it is best practice, at least in ACF, to lock code that writes to any shared scope:
You also might consider named locks as this allows more granular control again I think to say best practice is too broad. Shared scope means defensive coding but how defensive depends on your usage.
A
Sent from my phone
--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/071108b6-237a-4c32-8947-04f0db348fb9%40googlegroups.com.
When setting/getting session variables is it still necessary to cflock the process?
On Feb 23, 2015, at 1:00 PM, Jonathan Brookins <jon.br...@gmail.com> wrote:
> When setting/getting session variables is it still necessary to cflock the process?
The simple answer is: probably not. You won’t get memory corruption due to not locking around session variable access (like you used to on ColdFusion back in CF5 and earlier). Since ColdFusion moved to Java — and in Railo and Lucee — that has never been a problem.
You can still get a race condition if you might have multiple requests (in the same session) running concurrently. A race condition means that multiple requests (threads) could access / update the data in such a way as to give you unpredictable results (not memory corruption).
Here’s an example:
var v = session.count++;
--
You received this message because you are subscribed to the Google Groups "Lucee" group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+un...@googlegroups.com.
To post to this group, send email to lu...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/68b5a808-5ca1-45d7-88ad-873c4a4f8b3c%40googlegroups.com.