FISH-9748 bugfix: fix HA session race condition leading to session attribute loss #6956
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.
Description
Fixed regression introduced in #6637
Important Info
store.load()
instead ofswapIn()
to load sessions during update time comparison, asswapIn()
has side effects, such as replacing session object in the session map, and calling users' activation handlers every time a session is retrieved, leading to session loss and performance issuesTo further explain this, when the session is replaced in the map by
swapIn()
, other copies of the session hang around in other threads.Sessions get stored in HA store at the end of each request, and only the session currently in the map gets updated.
Those other copies do not get stored in the HA store when request ends, since they are no longer in the session map.
This leads to the data loss.
Performance problem is caused by the session map thrashing, and session creation callbacks being called every time the
swapIn()
method is called.Testing
Manual testing done