Skip to content

[BUG] RANDOMKEY may cause infinite loop during client pause write. #13862

@li-benson

Description

@li-benson

Describe the bug

When the client pause write is set and all the keys in the server are expired keys, executing the randomkey command will lead to an infinite loop.

To reproduce

  1. First, write a key with an expiration time. For example:
set key value ex 30
  1. Second, execute the client pause command. For example:
client pause 60000 write
  1. Third, wait for the key to expire, and then execute the randomkey command while the client pause is still in effect.
randomkey

Expected behavior

It is expected that the redis-server will return an expired key. However, in reality, there is no response at all, and the CPU utilization of the process reaches 100%.

Additional information

This bug will directly render redis-server unavailable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions