• guybe7's avatar
    Fix edge-case when a module client is unblocked (#8618) · 1b03a0d7
    guybe7 authored
    Scenario:
    1. A module client is blocked on keys with a timeout
    2. Shortly before the timeout expires, the key is being populated and signaled
       as ready
    3. Redis calls moduleTryServeClientBlockedOnKey (which replies to client) and
       then moduleUnblockClient
    4. moduleUnblockClient doesn't really unblock the client, it writes to
       server.module_blocked_pipe and only marks the BC as unblocked.
    5. beforeSleep kics in, by this time the client still exists and techincally
       timed-out. beforeSleep replies to the timeout client (double reply) and
       only then moduleHandleBlockedClients is called, reading from module_blocked_pipe
       and calling unblockClient
    
    The solution is similar to what was done in moduleTryServeClientBlockedOnKey: we
    should avoid re-processing an already-unblocked client
    
    (cherry picked from commit e58118cd)
    1b03a0d7
module.c 326 KB