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

hard coded session expiry #169

Closed
nagrgk opened this issue Oct 13, 2019 · 5 comments
Closed

hard coded session expiry #169

nagrgk opened this issue Oct 13, 2019 · 5 comments

Comments

@nagrgk
Copy link

nagrgk commented Oct 13, 2019

Hi

this latest codebase , Cm_RedisSession , read having hardcoded 3600*6 redis key expiry .
why this is hardcoded? it should be taking from magento admin cookie lifetime or maxlifetime from local.xml

image

@colinmollenhour
Copy link
Owner

The comment on that same line explains it. Also the git commit message (colinmollenhour/php-redis-session-abstract@8b94600).

@nagrgk
Copy link
Author

nagrgk commented Oct 15, 2019

Hi @colinmollenhour

yes there is comment but our expiration has to come from cookie management or from local.xml , max lifetime. this is something hardcoded and should not be 3600*6.

this does not seem to be right setting 5hrs for it

please explain

@colinmollenhour
Copy link
Owner

The expiration is set one when the session is read, and then when the process is finished and the session is written the expiration will be set again, to the proper value. So this is just a temporary value. If it is not set at all then if the page had a fatal error the session would never expire causing it to waste storage.

@nagrgk
Copy link
Author

nagrgk commented Oct 16, 2019

Hi @colinmollenhour ,
Thanks for your reply

as per my investigation with this session expiry, it was never set to actual value. it was set to 3600*6 always.

even in this place, I would suggest that it should be set to max_value or admin cookie value.

please check again on this because it is not working as expected.

@colinmollenhour
Copy link
Owner

It is working as expected for me.. E.g.:

127.0.0.1:6379> ttl sess_BkTaPwiWb,2c1Bh0r089gn1BlgsmlOlWq1VnJIpskQ4
(integer) 2591943

The session is written by the _writeRawSession method which definitely calls ->expire() so I don't see how this could not be working unless you have something causing your PHP process to exit ungracefully in which case session_write_close() may not be getting called, or you are using read-only. Please step through with a debugger and see if write is getting called.

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

No branches or pull requests

2 participants