Coder Social home page Coder Social logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Hello, this is a bug indeed and it is due to an integer overflow that only 
happens in 32 bit builds.

However there is no perfect fix as time_t is 32 bit in 32 bit archs. What I'm 
probably going to do is to set it to the max unix time when it would overflow, 
so that those keys will expire in 2036. But this somewhat violates the 
semantics as you set a given expire and read a different one using the TTL 
command... better to think a bit more about it :) But this is likely the best 
fix for 32 bit.

Thanks for reporting.

Salvatore

Original comment by [email protected] on 12 Sep 2011 at 11:33

from redis.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024

Original comment by [email protected] on 12 Sep 2011 at 11:34

  • Changed state: Accepted

from redis.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Redis already appears to reject larger expiration times (e.g. anything over 
2**31 on my system). I think that rejecting values that would overflow a 32-bit 
value after being added to the current time would be an acceptable solution.

An argument may be made that redis should not fall apart around year 2037 and 
should support 64-bit times on all architectures. This argument is somewhat 
orthogonal to the bug here - redis should never overflow the time value; if on 
a 64-bit system I specify 2**64-1000 as the expiration value it should either 
be rejected or treated correctly as a future value, instead of being wrapped 
around at 2**64.

Due to redis requesting a delta for the expiration time, people who want to 
specify a value far in the future are likely to use something like "10 years 
from now" as opposed to "January 1, 2020". As we get closer to 2037 having 
32-bit values for times will begin to affect more users.

Requiring a 64-bit redis for proper time handling has its own drawbacks. One is 
increased memory consumption of 64-bit redis, which is addressed in the faq. 
Another one is continuing existence of low-spec servers with under 4 gb of ram, 
where running a 64-bit operating system makes little or no sense.

In my case there was a bug in the code and I actually wanted a reasonable 
expiration time, but due to porting the code from memcached it misspecified the 
delta as a timestamp.

Original comment by [email protected] on 13 Sep 2011 at 2:10

from redis.

GoogleCodeExporter avatar GoogleCodeExporter commented on July 30, 2024
Thanks for the additional details, I moved the issue to the new issue system at 
github so that we can address it ASAP. Cheers.

Original comment by [email protected] on 20 Sep 2011 at 10:19

from redis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.