• Davi Arnaut's avatar
    Bug#36579 Dumping information about locks in use may lead to a server crash · 1ee4a3ac
    Davi Arnaut authored
    Dumping information about locks in use by sending a SIGHUP signal
    to the server or by invoking the "mysqladmin debug" command may
    lead to a server crash in debug builds or to undefined behavior in
    production builds.
    
    The problem was that a mutex that protects a lock object (THR_LOCK)
    might have been destroyed before the lock object was actually removed
    from the list of locks in use, causing a race condition with other
    threads iterating over the list. The solution is to destroy the mutex
    only after removing lock object from the list.
    
    mysys/thr_lock.c:
      Destroy the mutex that protects the lock object only after removing
      the lock object from the list of locks in use.
    1ee4a3ac
thr_lock.c 44.5 KB