Skip to content

[BUG] Hang and OOM in hrandfield #636

@yype

Description

@yype

Describe the bug

The following commands when used together could hang the keydb-server, making it unable to reply to any clients and increasingly consume memory.

To reproduce

hmset myhash a 1
hrandfield myhash -9223372036854775808

Expected behavior

An error should be returned instead of hanging. This could avoid DoS and server OOM.

Additional information

  1. This can be reproduced in the keydb 6.3.2 docker image .
  2. This is likely due to improper checks for the range. When issued these two commands, the memory consumption of keydb increases over time drastically and is likely to cause an OOM of the OS.
  3. A similar bug was also found in redis reported here: [BUG] hrandfield hangs the server redis/redis#11671, where redis also hangs. There is a long discussion about how to implement the fix, which can be found in its related PRs.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions