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

touch method implementation does not satisfy express-session logical contract #412

Closed
dkrieger opened this issue Jul 10, 2024 · 4 comments
Closed
Labels

Comments

@dkrieger
Copy link

I have read #289 (and #285 , @wavded ), and while 285 may have satisfied express-session 's logical requirements for touch at the time, it does not at this time. The rolling configuration option provided by express-session is effectively broken when using connect-redis, because while the redis entry TTL is updated, and the cookie expiry is updated in the browser, express-session invalidates the session once the original maxAge is exceeded. This logical breakage negates any performance benefit that was provided by 285, as the touch method implementation is not allowing rolling: true to do what it is supposed to do; instead, session data lingers in redis well after that session has been abandoned, and users' sessions are not extended.

@wavded
Copy link
Collaborator

wavded commented Jul 10, 2024

I haven't thought about this is a while 🤣

Is part of the issue that express-session isn't notifying the store to invalidate the session?

@dkrieger
Copy link
Author

dkrieger commented Jul 11, 2024

@wavded as I understand the intention of rolling, it's to allow requests to be used as a way to detect session activity and extend the effective expiry, where maxAge becomes a max idle time. So I think the issue issue is that the store is extending the redis entry, but not in a way that express-session cares about, and so the session is prematurely invalidated (making the redis entry orphaned in a sense).

Now all of that said, since digging into this, I've determined that I actually want the extension mechanism to regenerate a session ID, so I've switched to resave: false, rolling: false and manually regenerate the session and copy over the original session values as described in expressjs/session#425 . If someone preferred to use the session extension mechanism currently provided by express-session, this issue would still be relevant.

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the stale label Aug 11, 2024
Copy link

This issue was closed because it has been stalled for 5 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants