Comment 3 for bug 1408232

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

07:37:58 /home/jenkins/workspace/percona-server-5.6-debian-binary-32/label_exp/debian6-32/percona-server-5.6-5.6.22-71.0/sql/sql_parse.cc: In function 'int mysql_execute_command(THD*)':
07:37:58 /home/jenkins/workspace/percona-server-5.6-debian-binary-32/label_exp/debian6-32/percona-server-5.6-5.6.22-71.0/sql/sql_parse.cc:2609: error: 'per_query_variables_backup' may be used uninitialized in this function

is an actual PS bug:

int
mysql_execute_command(THD *thd)
{
...
  struct system_variables *per_query_variables_backup;
...
  if (this or that) goto error;
...
  if (lex->set_statement && !lex->var_list.is_empty()) {
    per_query_variables_backup= copy_system_variables(&thd->variables,
                                                      thd->m_enable_plugins);
...
error:
...
  if (lex->set_statement && !lex->var_list.is_empty()) {
...
    free_system_variables(&thd->variables, thd->m_enable_plugins);
    thd->variables= *per_query_variables_backup;
    my_free(per_query_variables_backup);
...
}

So, in case of "this or that" we end up with corrupted thd->variables going forward, and this might be the cause of numerous SET STATEMENT crashes: bug 1387951, bug 1417028, bug 1416975, bug 1416956, etc, etc, etc, see the set-statement bug tag.