Skip to content
Snippets Groups Projects
  • Vladislav Shpilevoy's avatar
    ca07088c
    func: fix not unloading of unused modules · ca07088c
    Vladislav Shpilevoy authored
    C functions are loaded from .so/.dylib dynamic libraries. A
    library is loaded when any function from there is called first
    time. And was supposed to be unloaded, when all its functions are
    dropped from the schema (box.schema.func.drop()), and none of them
    is still in a call. But the unloading part was broken.
    
    In fact, box.schema.func.drop() never unloaded anything. Moreover,
    when functions from the module were added again without a restart,
    it led to a second mmap of the same module. And so on, the same
    library could be loaded any number of times.
    
    The problem was in a useless flag in struct module preventing its
    unloading even when it is totally unused. It is dropped.
    
    Closes #4648
    ca07088c
    History
    func: fix not unloading of unused modules
    Vladislav Shpilevoy authored
    C functions are loaded from .so/.dylib dynamic libraries. A
    library is loaded when any function from there is called first
    time. And was supposed to be unloaded, when all its functions are
    dropped from the schema (box.schema.func.drop()), and none of them
    is still in a call. But the unloading part was broken.
    
    In fact, box.schema.func.drop() never unloaded anything. Moreover,
    when functions from the module were added again without a restart,
    it led to a second mmap of the same module. And so on, the same
    library could be loaded any number of times.
    
    The problem was in a useless flag in struct module preventing its
    unloading even when it is totally unused. It is dropped.
    
    Closes #4648
func.h 3.30 KiB