Stash icon indicating copy to clipboard operation
Stash copied to clipboard

Stash\Session allows race conditions with concurrent PHP scripts

Open SvenRtbg opened this issue 10 years ago • 0 comments

Essentially, this class has to use exclusive locks, which it does not at this time.

One of the methods "open" or "read" have to aqcuire an exclusive lock on the resource being read, and "write" or "close" have to release it again.

Otherwise two requests in the same session will concurrently read the data, alter it differently, and both write it back, with the later write overwriting the earlier write.

One could attempt to use CAS with a token to detect previous writes and try to resolve the situation then, which may work for non-conflicting changes, but will still fail with conflicting changes.

SvenRtbg avatar Mar 27 '15 13:03 SvenRtbg