• debing.sun's avatar
    Rebuild function engines for function flush command (#13383) · ffff7fea
    debing.sun authored
    
    
    ### Issue
    The current implementation of `FUNCTION FLUSH` command uses
    `lua_unref()` to unreference script closures in Lua vm. However,
    invoking `lua_unref()` during lazy free (`ASYNC` argument) is risky
    since it is not thread-safe.
    
    Another issue is that using `lua_unref()` to unreference references does
    not trigger GC, This can result in the Lua VM leaves a significant
    amount of garbage, which may never be cleaned up if not properly GC.
    
    ### Solution
    The proposed solution is to completely rebuild the engines, resulting in
    a brand new Lua VM.
    
    ---------
    Co-authored-by: default avatarmeir <meir@redis.com>
    ffff7fea
function_lua.c 16.7 KB