• Oran Agra's avatar
    Obuf limit, exit during loop in *RAND* commands and KEYS · 3148f3e8
    Oran Agra authored
    Related to the hang reported in #11671
    Currently, redis can disconnect a client due to reaching output buffer limit,
    it'll also avoid feeding that output buffer with more data, but it will keep
    running the loop in the command (despite the client already being marked for
    disconnection)
    
    This PR is an attempt to mitigate the problem, specifically for commands that
    are easy to abuse, specifically: KEYS, HRANDFIELD, SRANDMEMBER, ZRANDMEMBER.
    The RAND family of commands can take a negative COUNT argument (which is not
    bound to the number of elements in the key), so it's enough to create a key
    with one field, and then these commands can be used to hang redis.
    For KEYS the caller can use the existing keyspace in redis (if big enough).
    3148f3e8
t_zset.c 140 KB