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.
This commit is contained in:
Marc Alff 2015-04-08 07:01:39 +02:00
parent 45b51146a9
commit 7285b4c495
3 changed files with 12 additions and 2 deletions

View File

@ -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),

View File

@ -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];

View File

@ -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);
}