• Kristian Nielsen's avatar
    MDEV-33443: Unsafe use of LOCK_thd_kill in my_malloc_size_cb_func() · fdaa7a96
    Kristian Nielsen authored
    
    
    my_malloc_size_cb_func() can be called from contexts where it is not safe to
    wait for LOCK_thd_kill, for example while holding LOCK_plugin. This could
    lead to (probably very unlikely) deadlock of the server.
    
    Fix by skipping the enforcement of --max-session-mem-used in the rare cases
    when LOCK_thd_kill cannot be obtained. The limit will instead be enforced on
    the following memory allocation. This does not significantly degrade the
    behaviour of --max-session-mem-used; that limit is in any case only enforced
    "softly", not taking effect until the next point at which the thread does a
    check_killed().
    Reviewed-by: default avatarMonty <monty@mariadb.org>
    Signed-off-by: default avatarKristian Nielsen <knielsen@knielsen-hq.org>
    fdaa7a96
mysqld.cc 335 KB