Skip to content

expiration of lock_key should be relative #144

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

Closed
crhg opened this issue Jul 16, 2014 · 6 comments
Closed

expiration of lock_key should be relative #144

crhg opened this issue Jul 16, 2014 · 6 comments

Comments

@crhg
Copy link
Contributor

crhg commented Jul 16, 2014

Memcached uses monotonic clock if available, and it differs from the clock outside of it. The difference may be very large when memcached is running long time. In such cases, specifying expiration time as absolute time does not work as expected.

For example, the clock of our memcached running about 2 years are about 1 hour ahead. As a result, session lock does not work properly because expire parameter of lock (= time() + max_execution_time(30s) + 1) is past from the point of view of memcached, and therefore the lock expires immediately.

This problem can be avoided by specifying expiration parameter as number of seconds starting from current time, not absolute Unix time.

@mkoppanen
Copy link
Member

Makes sense. Can you open a PR for this?

@crhg
Copy link
Contributor Author

crhg commented Jul 16, 2014

It is difficult for me because I'm not familiar with github.

@mkoppanen
Copy link
Member

Ok, I'll fix this today. Thanks for the report!

@johnwho
Copy link

johnwho commented Sep 1, 2014

Does anyone have a patch for this?
I'll need it before long because my memcached is running for over a year.

@mkoppanen
Copy link
Member

See #149

@johnwho
Copy link

johnwho commented Sep 2, 2014

Thanks.

mkoppanen added a commit that referenced this issue Oct 6, 2014
@crhg crhg mentioned this issue Feb 8, 2016
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

3 participants