summaryrefslogtreecommitdiff
path: root/sql/sql_show.cc
diff options
context:
space:
mode:
authorMarc Alff <marc.alff@oracle.com>2015-04-08 07:01:39 +0200
committerMarc Alff <marc.alff@oracle.com>2015-04-08 07:01:39 +0200
commit7285b4c49558e79072907642df63290748e45667 (patch)
tree18286f9b3eacf07cbacb06d0e7c4e23966f02523 /sql/sql_show.cc
parent45b51146a90479e3f4d74fdf0256acbcbb1b4281 (diff)
downloadmariadb-git-7285b4c49558e79072907642df63290748e45667.tar.gz
Bug#20788853 MUTEX ISSUE IN SQL/SQL_SHOW.CC RESULTING IN SIG6. SOURCE LIKELY
FILL_VARIABLES Prevent mutexes used in SHOW VARIABLES from being locked twice.
Diffstat (limited to 'sql/sql_show.cc')
-rw-r--r--sql/sql_show.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 51f5d75e49b..4c9811cea2d 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -6317,7 +6317,11 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
Lock LOCK_plugin_delete to avoid deletion of any plugins while creating
SHOW_VAR array and hold it until all variables are stored in the table.
*/
- mysql_mutex_lock(&LOCK_plugin_delete);
+ if (thd->fill_variables_recursion_level++ == 0)
+ {
+ mysql_mutex_lock(&LOCK_plugin_delete);
+ }
+
// Lock LOCK_system_variables_hash to prepare SHOW_VARs array.
mysql_rwlock_rdlock(&LOCK_system_variables_hash);
DEBUG_SYNC(thd, "acquired_LOCK_system_variables_hash");
@@ -6327,7 +6331,11 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond)
res= show_status_array(thd, wild, sys_var_array, option_type, NULL, "",
tables->table, upper_case_names, cond);
- mysql_mutex_unlock(&LOCK_plugin_delete);
+ if (thd->fill_variables_recursion_level-- == 1)
+ {
+ mysql_mutex_unlock(&LOCK_plugin_delete);
+ }
+
DBUG_RETURN(res);
}