summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorVladislav Vaintroub <wlad@mariadb.com>2018-01-27 17:46:31 +0000
committerVladislav Vaintroub <wlad@mariadb.com>2018-01-29 07:33:52 +0000
commit7cdf759c86a3b80bf215fcc6baab87b930425170 (patch)
treefa541cde13156bd523bb9884ed5f163905aa519d /sql/sql_show.cc
parent1da063a45bc43ac2c5761d8e091e55b8cac123cf (diff)
downloadmariadb-git-7cdf759c86a3b80bf215fcc6baab87b930425170.tar.gz
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
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 03107aa4574..60796df35d4 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -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);
}