-
Notifications
You must be signed in to change notification settings - Fork 343
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
Race condition on logout, session alive again #328
Comments
This has always been a limitation of I don't know of a way we can account for concurrent session requests racing. On session deletion, the keys are gone by design. It seems we'd have to keep them around just in case something happens right away and try to clean them up but the rules around that don't seem clear IMO. That my 2 cents. I see it important to match connect-redis API with your implementation, but I have a feeling this issue exists in more stores. Have you any ideas on what you'd change in the express-session API? Any luck in discussing this with the maintainers there? |
I read the past issues and it's clear that there's a race condition on concurrent updates. That's, however, an issue that only the application can solve, and not really a problem just with sessions. Destroy is different because the user logs out and the session becomes alive again. Think you're on facebook, look at the list of your sessions, click destroy on one that you don't recognize... and that's not really destroyed. I think there are 2 solutions here:
|
Hey @0x0ece , just acknowledging that I have read your comment and am still thinking about this. Part of the "perk" of this session storage library is we don't keep any sessions around after they are destroyed. We keep a low footprint and we stay fast. I don't love keeping session objects alive and adding a "cleanup" task in case sessions get quickly recreated as it adds more overhead to the process. It seems like your idea of differentiating from an insert versus an update may get around this? I noticed your fork no longer exists, did this get moved? Ideally, any API change would be something that would get integrated into the main |
Hi, sorry for the broken link, we decided to rename it to I agree, reaching out to |
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. |
I see you have a conversation started with @dougwilson on this matter. I will keep this case open to see if anything comes out that that may apply to this. |
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. |
This issue was closed because it has been stalled for 5 days with no activity. |
This fixes an issue where multiple requests modifying the session are in progress at the same time, before this fix the last one to complete looses the changes made by the other in flight request. After this fix changes are merged in from all in flight requests. #328
This fixes an issue where multiple requests modifying the session are in progress at the same time, before this fix the last one to complete looses the changes made by the other in flight request. After this fix changes are merged in from all in flight requests. tj/connect-redis#328
If this does get re-added it should probably be an optional feature, as merging various session states can break apps in other ways. Particularly, |
Hi, currently express-session + connect-redis suffer from a race condition on logout:
For context we've been working on (what we think is) a more secure fork of express-session, and also worked on a similar fix for connect-typeorm. The issue with redis came up discussing with a user interested in our fork, but using connect-redis.
TBH I'm not sure what the best solution would be with redis. IMO the real issue is express-session that offers a generic set instead of an explicit insert vs update, but it what it is... maybe an opportunity is to have a better/richer interface for stores.
If you have ideas, happy to work on a PR.
P.S: and big congrats on having 0 open issues, pretty rare!
Edit: renamed the package to
express-session-jwt
, so fixed the link aboveThe text was updated successfully, but these errors were encountered: