HSETEXPIRE with an overflowing TTL returns OK and deletes the whole hash
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
Research direction
Start with CommandHSetExpire in src/commands/cmd_hash.cc and trace how its parsed TTL reaches Hash::MSet and the key expiration metadata. Compare the overflow handling with the related SET ... EX issue #3674 and PR #3680. Done means an overflowing TTL returns an invalid expire time error and leaves the existing hash unchanged; the payload names no test file.
Written by the indexing model from the issue text.
Description
Search before asking
- I had searched in the issues and found no similar issues.
Version
unstable, commit d8aeed4 (Linux x86_64)
Minimal reproduce step
HSET h f1 v1
HSETEXPIRE h 18446744073709551 f2 v2
HGETALL h
EXISTS h
What did you expect to see?
An invalid expire time error, with h unchanged (f1 -> v1, no TTL).
What did you see instead?
HSETEXPIRE returns OK, HGETALL is empty and EXISTS returns 0. Both the new field and the existing f1 are gone.
Anything Else?
CommandHSetExpire in src/commands/cmd_hash.cc parses the TTL as uint64_t with no upper bound, then passes ttl_ * 1000 + util::GetTimeStampMS() to Hash::MSet, which sets it as the key's metadata expire.
With ttl = 18446744073709551, ttl * 1000 is just under 2^64. Adding the current time wraps it to a moment in the past, so the whole hash expires immediately. 18446744073709551615 behaves the same way.
This is the same class of bug as #3674 (SET ... EX overflow). PR #3680 does not cover HSETEXPIRE. SET k v EX 9223372036854775807 from #3674 also reproduces on the same build.
Are you willing to submit a PR?
- I'm willing to submit a PR!
- Dominant language
- C++
- Stars
- 4.5k
- Forks
- 686
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 40
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/kvrocks
-
SSCAN, HSCAN, ZSCAN don't finish when an empty-string member is returned at the end of a pagePossibly taken @ggyuchive claimed this today. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
`GEOSEARCH` / `GEORADIUS` with a negative radius hangsPossibly taken @ggyuchive claimed this 6 days ago. Openbug
Difficulty 3/5 1-2 days Newbie friendliness 25/100
Maintainers usually reply within 1 day
-
`ZDIFFSTORE` and `ZINTERSTORE` with numkeys 0 crash the server (SIGSEGV)Possibly taken @siddiqueirshad claimed this 8 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Support the `SUNIONCARD` commandPossibly taken @PoisonGodv claimed this 2 days ago. Openenhancement
Difficulty 3/5 1-2 days Newbie friendliness 58/100
apache/kvrocks#3723 · 1 comment ·
Maintainers usually reply within 1 day
-
`NAMESPACE ADD/SET/DEL` and `CONFIG REWRITE` rewrite `kvrocks.conf` without fsync: after a power loss new namespaces vanish, and deleted namespaces / rotated tokens are valid againPossibly taken @Tyagiquamar claimed this 14 days ago. Openbug
Difficulty 4/5 3-5 days Newbie friendliness 50/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 62/100
mw00/project-maya#877 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
llvm/offload-test-suite#1703 ·
Maintainers usually reply within 1 day
-
backlog bug
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
EchoTools/nevr-runtime#2154 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
BGI-shenzhen/PopLDdecay#25 ·