On Tuesday, April 5, 2011 9:46:41 AM UTC-4, Jonathan Lundell wrote:
>
> On Apr 4, 2011, at 11:22 PM, Anthony wrote:
> > You might also want to lock the session even if it is merely being read
> -- otherwise, if a second action writes to the session after a first action
> has read it in, then the first action will be working with a version of the
> session that is no longer up-to-date.
> >
>
> In particular, you have the possible sequence with two overlapping
> requests:
>
> read-1
> read-2
> write-2
> write-1
>
> ...so any changes #2 makes are lost.
>
Yes, that's a race condition with writing. My point was that even if the
first action is merely reading (but not doing any writing), you can have
problems. For example:
Action 1: read session
Action 2: read session
Action 2: write session
Action 1: make some decision/calculation based on session data that is no
longer up to date