-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Session locking problems? #7255
Comments
This happens in prod and dev, and only for secured pages. |
This happens because PHP does session locking. If you have one request with an open PHP session, all other requests for the same session will block in session_start() until the first request finished. More precisely, all requests for that session will be executed one after another. This is necessary to avoid race conditions - assume both requests were handled in parallel and modified values stored in the session, then PHP would have to bring a merge strategy (which it can't for the general case) or the "last one wins" which is probably not what you want either. You might want to experiment with session_write_close() or google for "php session concurrency" or the like. Probably not a Symfony bug, though. |
Try this, on a vanilla symfony-2.2.0
Edit src/Acme/DemoBundle/Controller/SecuredController.php, add sleep(100); to the helloAction.
In your browser, open symfony, access the secured area of the Acme Demo, login as admin.
Open /demo/secured/hello/World, it should load a long time because of the sleep().
Open /demo/secured/hello/admin/World in a second tab.
Now you will see that the second tab will return its response only AFTER the sleep() of the first tab is finished.
Why is this so? Does it happen because of session locking? Or is it a bug?
The text was updated successfully, but these errors were encountered: