• Davi Arnaut's avatar
    Bug#43706: libmysqld segfaults when re-intialised · 92aeafda
    Davi Arnaut authored
    Bug#44091: libmysqld gets stuck waiting on mutex on initialization
    
    The problem was that libmysqld wasn't enforcing a certain
    initialization and deinitialization order for the mysys
    library. Another problem was that the global object used
    for management of log event handlers (aka LOGGER) wasn't
    being prepared for a possible reutilization.
    
    What leads to the hang/crash reported is that a failure
    to load the language file triggers a double call of the
    cleanup functions, causing an already destroyed mutex to
    be used.
    
    The solution is enforce a order on the initialization and
    deinitialization of the mysys library within the libmysqld
    library and to ensure that the global LOGGER object reset
    it's internal state during cleanup.
    
    mysys/my_init.c:
      Deinitialize only if initialized already.
    sql/log.cc:
      Reset state.
    92aeafda
my_init.c 14.2 KB