• Binbin's avatar
    Un-register notification and server event when RedisModule_OnLoad fails (#12809) · d6f19539
    Binbin authored
    When we register notification or server event in RedisModule_OnLoad, but
    RedisModule_OnLoad eventually fails, triggering notification or server
    event
    will cause the server to crash.
    
    If the loading fails on a later stage of moduleLoad, we do call
    moduleUnload
    which handles all un-registration, but when it fails on the
    RedisModule_OnLoad
    call, we only un-register several specific things and these were
    missing:
    
    - moduleUnsubscribeNotifications
    - moduleUnregisterFilters
    - moduleUnsubscribeAllServerEvents
    
    Refactored the code to reuse the code from moduleUnload.
    
    Fixes #12808.
    d6f19539
module.c 561 KB