-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deadlock when using session_start(array("read_and_close"=>true)); #18
Comments
Thinking back about this, the |
I dunno, Reading the docs, how does "lazy_write" not break the locking as well? Does it mean that if session data is not changed it will also just call open, read, close? I suppose in Magento the session data is always updated so maybe that's why this hasn't been reported as a bug yet.. |
Oh, there is already a |
I'm not sure there's any reason you would want to get a lock on read. If you're in a |
Perhaps not in the case of Magento but in a more strict environment it may be that requests should be serialized. I'm not sure how the default files handler handles read_and_close but it does use locking. I think requiring serialized requests is not a good way to design but if you want pure performance there is the 'disable_locking' flag. |
In PHP 7,
session_start()
can take an$options
array parameter (php doc)Using this parameter with
Cm_RedisSession
will cause theread()
function to increment thelock
field of the redis hash structure, thenclose()
will be immediately called.Unfortunately,
close()
does not decrement thelock
field, which means that any subsequent call toread()
will wait until the configured timeout before taking the lock on the session.Submitted PR #17, however, I'm not convinced this is the right way of handling this issue.
It might make more sense to add logic to
read()
to release the lock when being used with "read_and_close".The text was updated successfully, but these errors were encountered: