Conversation
juliusknorr
commented
Apr 26, 2022
d42911c to
b8a0eb8
Compare
Member
Author
|
Needs extra care for talk which seems to have issues with no session locking and there this PR could then lead to similar problems where the one session might be lost if the other one writes |
Member
|
any connection with #31286 ? |
74d3fbc to
f8650f3
Compare
Member
Author
|
Tested with the Talk edge case of joining a public room with a different user and seems to work. Further cases to test:
|
7b32b07 to
bb46321
Compare
bb46321 to
56a0166
Compare
Member
Author
PVince81
reviewed
Aug 17, 2022
Member
|
please rebase/fixup |
Sessions are a locking operation until we write close them, so close them early and reopen later in case we want to write to them Signed-off-by: Julius Härtl <jus@bitgrid.net>
… read_and_close Fixed #29356 Signed-off-by: Julius Härtl <jus@bitgrid.net>
Signed-off-by: Julius Härtl <jus@bitgrid.net>
56a0166 to
1b43fbe
Compare
Merged
CarlSchwan
approved these changes
Aug 18, 2022
Merged
8 tasks
This was referenced Nov 3, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Slightly different approach about has the same target as #29356 to reduce the time that request might need to wait for locked sessions.
We already try to write and close the session early but on multiple concurrent requests that is still not fast enough to not have noticeable wait time on the lock. To my knowledge we don't write anything into the session that would be critical in terms of using already read value that has been updated by another request, so I think this approach should be fine from the potential race condition perspective, especially with reopening the session we would read again.
Impact on page load can be tested by adding a sleep for specific routes:
Currently every request writes to the session
server/lib/base.php
Line 455 in d42911c
I decided to go for a config flag for this, as for most setups having a session timeout that is happening at the exact second might not be really needed. If that is not used, PHP may clean up the session at a later point depending on the session garbage collection configuration. If using redis, the session lifetime will be set anyways on redis, so redis would take care of the deletion using configured key eviction policy.