diff options
author | Marc Alff <marc.alff@oracle.com> | 2015-04-08 07:01:39 +0200 |
---|---|---|
committer | Marc Alff <marc.alff@oracle.com> | 2015-04-08 07:01:39 +0200 |
commit | 7285b4c49558e79072907642df63290748e45667 (patch) | |
tree | 18286f9b3eacf07cbacb06d0e7c4e23966f02523 /sql | |
parent | 45b51146a90479e3f4d74fdf0256acbcbb1b4281 (diff) | |
download | mariadb-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')
-rw-r--r-- | sql/sql_class.cc | 1 | ||||
-rw-r--r-- | sql/sql_class.h | 1 | ||||
-rw-r--r-- | sql/sql_show.cc | 12 |
3 files changed, 12 insertions, 2 deletions
diff --git a/sql/sql_class.cc b/sql/sql_class.cc index cc57ba726b4..cbdaca0fac5 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -802,6 +802,7 @@ THD::THD() rli_fake(0), rli_slave(NULL), user_time(0), in_sub_stmt(0), fill_status_recursion_level(0), + fill_variables_recursion_level(0), binlog_unsafe_warning_flags(0), binlog_table_maps(0), table_map_for_update(0), diff --git a/sql/sql_class.h b/sql/sql_class.h index 22b4eabac13..5a5e8b48754 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1603,6 +1603,7 @@ public: decremented each time before it returns from the function. */ uint fill_status_recursion_level; + uint fill_variables_recursion_level; /* container for handler's private per-connection data */ Ha_data ha_data[MAX_HA]; 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); } |