-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Memory leak in Index for principal null
#1988
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
Conversation
Verified this PR will fix unexpected key |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @ruslanys!
The changes look good to me.
Could you please squash the commits into one, and add a descriptive commit message, for example
Fix memory leak with null principal in Redis
Closes gh-1987
@eleftherias Thank you for the feedback! Sure. Will do right now. |
Thanks @ruslanys! |
Thank you @eleftherias ! |
@eleftherias Since this regression also reached the 2.5.x branch via #1941, could you backport it there too please? I can open a PR if you prefer. |
Thanks for pointing that out @jebeaudet. I will backport it to 2.5.x as well. |
I believe this should be a solution for the reported issue.
The explanation is the following. There are only two places where we add
sessionId
into an index: first, second.And the first one is under the validation: if (principal != null).
So, we do not create an index if a principal is
null
.When a session changes its ID, we try to change it in the index as well.
But we do not check here that the principal is null. So, we do not check if the index exists.
In the end, instead of replacing sessionId in Index, we create a new one. And this leads to a memory leak.
Close #1987