• Oran Agra's avatar
    Obuf limit, exit during loop in *RAND* commands · 4779ed5e
    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: SRANDMEMBER.
    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.
    
    NOTICE:
    For in Redis 7.0 this fix handles KEYS as well, but in this branch
    it doesn't, details in #11676
    4779ed5e
obuf-limits.tcl 6.19 KB