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

GETEX with PERSIST option create invalid time value #705

Closed
boazsade opened this issue Jan 19, 2023 · 1 comment
Closed

GETEX with PERSIST option create invalid time value #705

boazsade opened this issue Jan 19, 2023 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@boazsade
Copy link
Contributor

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behaviour:

  1. run "string_family_test " under "build-dbg" , the test "GetEx" will report "db_slice.cc:592:42: runtime error: signed integer overflow: -9223372036854775808 * 1000 cannot be represented in type 'long int'" (you would not see this in optimised build because this is undefined when the code is optimised).
  2. OR, in redis-cli
  3. set foo bar
  4. getex foo PERSIST
  5. See error "/db_slice.cc:592:42: runtime error: signed integer overflow: -9223372036854775808 * 1000 cannot be represented in type 'long int'" in console.

Expected behavior
This should not happen, since it indicating that we're trying to calculate invalid time for the expiration.
Please note that this happen as a result of the function ":ExpireParams::Calculate" in db_slice.cc that is normalised the time value to ms by multiplying by 1000, but the input value in this case is INT64_MIN, a value that cannot be multiple to make it smaller (as its already the smallest it can be).

Environment (please complete the following information):

  • OS: ubuntu 22.04
  • Kernel: Linux dfly2 5.15.0-57-generic 63-Ubuntu SMP Thu Nov 24 13:43:17 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
  • Containerized?: Bare Metal
  • Dragonfly Version: 0.13.0

Reproducible Code Snippet
The test GetEx under string_family_test.cc

@boazsade
Copy link
Contributor Author

This fix is to not check expiration value in case PERSIST is set. In this case, just set the value for expiration to 0, which means don't expire this value.
So when the user with run the command "GETEX foo PERSIST" it will not try to calculate the expiration time, since there is none. We will just update the value (if found), to not have expiration time, which means, it never expire.
This will also make the code a little simpler, since before that, we would check whether persist is enabled, and now, this is done at a single location.

@romange romange closed this as completed Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants