dbRandomKey() in db.c will not terminate when executed on a replica against a database where all items are logically expired. The function will only return under two conditions: there exist no keys in the dictionary, or a valid non-expired key is found. Given that replicas do not physically expire items and instead just skip returning them, an infinite loop occurs.
Reproduction steps:
$ redis-server --port 6379
$ redis-server --port 6380 --slaveof localhost 6379
$ redis-cli -p 6379
> set foo bar ex 10
$ kill -STOP <pid of first redis server>
$ redis-cli -p 6380
> get foo
"bar"
> get foo
(nil)
> randomkey
An infinite loop occurs on the follower, and even when the master is started again, the replica won't break out of the loop to consume the deletion.
On a related node, EXISTS returns true for logically expired keys on a replica, which is inconsistent with the rest of the read commands.
Both of these issues appear to be present in the latest unstable branch.