Repository navigation
RedisIndexedSessionRepository should remove original session id from expirations on changeSessionId - #4150
RedisIndexedSessionRepository should remove original session id from expirations on changeSessionId#4150dodoshell wants to merge 1 commit into
Conversation
MinuteBasedRedisSessionExpirationStore#remove looks the session up by id to find its expiration set. saveChangeSessionId called it after the session key had been renamed, so the lookup returned null and the original id stayed in the expirations set. Remove it before renaming. Closes spring-projectsgh-4149 Signed-off-by: dodoshell <326978213+dodoshell@users.noreply.github.com>
|
@dodoshell thank you for creating the PR. I've noticed that the destination of your PR is the I believe merging the fix to the I was also working on the same fix but since you created the PR first lets keep your changes. The only difference between my changes and yours are the tests. Feel free to use anything from my changes if necessary jhonatanhulse@f3d790c Thank you very much. |
|
Thanks for taking a look, and for the link to your commit. I based it on |
Summary
When
RedisIndexedSessionRepositorysaves a session afterchangeSessionId(),saveChangeSessionId()renames the session key first and only then callsexpirationStore.remove(originalSessionId).MinuteBasedRedisSessionExpirationStore.remove()looks the session up by its id to compute the expiration bucket, so after the rename the lookup returnsnullandexpires:<originalId>is left inspring:session:expirations:<minute>.This change calls
expirationStore.remove(this.originalSessionId)before the keys are renamed, as suggested in the issue.Test plan
./gradlew :spring-session-data-redis:test --tests org.springframework.session.data.redis.RedisIndexedSessionRepositoryTests(RED before fix:WantedButNotInvokedonboundSetOps(...).remove("expires:session-id"); GREEN after)./gradlew :spring-session-data-redis:check -x integrationTest(unit tests, checkstyle, format)Closes #4149