• Monty's avatar
    Do not use MEM_ROOT in set_killed_no_mutex() · dc116541
    Monty authored
    The reason for this change are the following:
    - If we call set_killed() from one thread to kill another thread with
      a message, there may be concurrent usage of the MEM_ROOT which is
      not supported (this could cause memory corruption).
      We do not currently have code that does this, but the API allows this
      and it is better to be fix the issue before it happens.
    - The per thread memory tracking does not work if one thread uses
      another threads MEM_ROOT.
    - set_killed() can be called if a MEM_ROOT allocation fails.  In this case
      it is not good to try to allocate more memory from potentially the same
      MEM_ROOT.
    
    Fix is to use my_malloc() instead of mem_root for killed messages.
    dc116541
sql_class.h 235 KB