Skip to content
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

FISH-9748 bugfix: fix HA session race condition leading to session attribute loss #6956

Merged
merged 1 commit into from
Oct 7, 2024

Conversation

lprimak
Copy link
Contributor

@lprimak lprimak commented Sep 18, 2024

Description

Fixed regression introduced in #6637

Important Info

  • compare update times to stored session in HA scenarios only
  • Use store.load() instead of swapIn() to load sessions during update time comparison, as swapIn() 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 issues

To 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

@lprimak lprimak changed the title enh: fix HA session race condition leading to data loss enh: fix HA session race condition leading to session attribute loss Sep 18, 2024
@lprimak lprimak marked this pull request as ready for review September 18, 2024 06:46
@Pandrex247 Pandrex247 changed the title enh: fix HA session race condition leading to session attribute loss FISH-9748 enh: fix HA session race condition leading to session attribute loss Sep 18, 2024
@lprimak lprimak changed the title FISH-9748 enh: fix HA session race condition leading to session attribute loss FISH-9748 bigfix: fix HA session race condition leading to session attribute loss Sep 18, 2024
@lprimak lprimak force-pushed the fix-session-data-loss branch from 0561a25 to 6f22319 Compare September 18, 2024 17:48
@lprimak lprimak changed the title FISH-9748 bigfix: fix HA session race condition leading to session attribute loss FISH-9748 bugfix: fix HA session race condition leading to session attribute loss Sep 24, 2024
@lprimak
Copy link
Contributor Author

lprimak commented Sep 29, 2024

Don't forget about me :) :)

@lprimak
Copy link
Contributor Author

lprimak commented Oct 4, 2024

@Pandrex247 dont forget me :) thank you

@breakponchito breakponchito self-requested a review October 7, 2024 23:06
@breakponchito
Copy link
Contributor

breakponchito commented Oct 7, 2024

@lprimak @Pandrex247 I already tested with my reproducer and the resulting behavior is what we expect. On the following url you will find the steps I tested: #6637

Copy link
Contributor

@breakponchito breakponchito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@breakponchito breakponchito merged commit f51668a into payara:main Oct 7, 2024
1 check passed
@lprimak lprimak deleted the fix-session-data-loss branch October 7, 2024 23:18
Pandrex247 pushed a commit to Pandrex247/Payara that referenced this pull request Oct 10, 2024
FISH-9748 bugfix: fix HA session race condition leading to session attribute loss
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants