pexpire/expire key with large number ttl will del key immediately #3739

GitHubMota opened this Issue Jan 10, 2017 · 0 comments


None yet

1 participant


For pexpire, set pttl near INT64_MAX:> set k v
OK> pexpire k 9223372036854775807
(integer) 1> get k

For expire, set ttl near INT64_MAX/1000:> set k v
OK> expire k 9223372036854775
(integer) 1> get k

In redis source, when = mstime()+ttl(big number) will become negative, so when<mstime(), and del the key immediately.
For this situation, I think it's better to forbid this operation by return ERR. Nobody expect to del the key with expire it with big ttl instead of a negative ttl. He probably excute this by mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment