mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-14485 Server hangs on startup in THD::init
Solve 3 way deadlock between plugin_initialiaze(), THD::init() and mysql_sys_var_char(). The deadlock exists because of the lock order inversion between LOCK_global_system_variables mutex and LOCK_system_variables_hash read-write lock- In this case, it is enough to change LOCK_system_variables_hash to prefer reads to fix the deadlock, i.e change it to mysql_prlock_t
This commit is contained in:
@ -7399,7 +7399,7 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
|
||||
COND *partial_cond= make_cond_for_info_schema(thd, cond, tables);
|
||||
|
||||
mysql_rwlock_rdlock(&LOCK_system_variables_hash);
|
||||
mysql_prlock_rdlock(&LOCK_system_variables_hash);
|
||||
|
||||
/*
|
||||
Avoid recursive LOCK_system_variables_hash acquisition in
|
||||
@ -7414,7 +7414,7 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
|
||||
res= show_status_array(thd, wild, enumerate_sys_vars(thd, sorted_vars, scope),
|
||||
scope, NULL, "", tables->table,
|
||||
upper_case_names, partial_cond);
|
||||
mysql_rwlock_unlock(&LOCK_system_variables_hash);
|
||||
mysql_prlock_unlock(&LOCK_system_variables_hash);
|
||||
DBUG_RETURN(res);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user