Repository navigation
Conversation
leemannd
commented
Nov 3, 2026
Member
- forward port of [17.0][IMP] session_redis: add absolute expiration option #534
- bugfixes
ODOO_SESSION_REDIS_EXPIRATION_ABSOLUTE=1 makes authenticated sessions expire ODOO_SESSION_REDIS_EXPIRATION seconds after the login, whatever the activity. Default mode: SET … EX instead of SET then EXPIRE, so a failed EXPIRE can no longer leave a key without TTL. rotate() also resets should_rotate, as odoo.http.FilesystemSessionStore does.
In 19.0, the store reuses odoo.http.FilesystemSessionStore.rotate, which saves the session under a new key without marking it as new: * login, logout and MFA (hard rotation): SET … XX on the new key failed, so the session was never stored and the user could not log in * soft rotation, every odoo.http.SESSION_ROTATION_INTERVAL: the data moves to a new key, so KEEPTTL could not carry the TTL over rotate() now saves the new key as a new session (full TTL, as the 17.0 rotate did) and, on a soft rotation in absolute mode, gives it the remaining TTL of the old key, read before the old key gets its deletion_time. A request following a soft rotation already done by a concurrent one keeps the TTL of the new key. The old key of a soft rotation (deletion_time) no longer takes the KEEPTTL path.
On a soft rotation, odoo.http keeps the old session with a deletion_time, a timestamp (time.time() + SESSION_DELETION_TIMER), but save() used it as a TTL. Being a float, it was then replaced by the 3 hours of the anonymous sessions: the old session id stayed valid for 3 hours instead of 2 minutes. The TTL is now the time left until deletion_time.
ODOO_SESSION_REDIS_EXPIRATION and ODOO_SESSION_REDIS_EXPIRATION_ANONYMOUS are read as strings, and save() replaced any expiration that is not an int by the 3 hours of the anonymous sessions: whatever their value, all the sessions expired after 3 hours of inactivity. The expirations are now converted to int when the store is created (unset, empty or 0 meaning the default), and the workaround in save() is removed.
get_missing_session_identifiers() looked for "session::session:<id>*" instead of the "session:<id>*" keys built by the store, so every session was reported missing, and res.device.log._update_revoked() flagged the device logs of still valid sessions as revoked. The pattern is now built with build_key(), as the keys are.
santostelmo
approved these changes
Nov 4, 2026
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.