Bug #68461 potential deadlock that caused by concurrent DDL and 'SET GLOBAL ' command
Submitted: 22 Feb 2013 8:07 Modified: 22 Feb 2013 13:35
Reporter: zhai weixiang (OCA) Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.1 OS:Any
Assigned to: Jon Olav Hauglid CPU Architecture:Any

[22 Feb 2013 8:07] zhai weixiang
Description:
interesting code path that may lead to deadlock( based on code review of MySQL 5.1.68)

session 1 (
SET GLOBAL SLOW_QUERY_LOG = OFF;
SET GLOBAL LOG_OUTPUT = 'TABLE';
SET GLOBAL SLOW_QUERY_LOG = ON;
)

sys_var_log_state::update
    --->hold LOCK_global_system_variables
    LOGGER::activate_log_handler
        activate_log
            open_performance_schema_table
               open_ltable
                      open_table --------->require LOCK_open

session 2 ( a DDL request):

mysql_alter_table
    mysql_create_table_no_lock
              ---->hold LOCK_open
              rea_create_table
                    ha_create_table
                        ha_innodb::create
                            create_options_are_valid
                                 mysql_sys_var_char
                                    intern_sys_var_ptr ----->require LOCK_global_system_variables

It seems 5.5 was not affected because LOCK_global_system_variables was released before activate_log_handler was called

How to repeat:
based on code review

Suggested fix:
Is it safe to release LOCK_global_system_variables before activate_log_handler was called in 5.1?
I am not sure
[22 Feb 2013 8:37] MySQL Verification Team
easy to repeat on 5.1.68

Attachment: bug68461_5.1.68_stack_traces.txt (text/plain), 9.40 KiB.

[22 Feb 2013 8:42] MySQL Verification Team
Seems I repeated a slightly different deadlock, but still, none of this is repeatable on 5.5.30.
[22 Feb 2013 13:35] Jon Olav Hauglid
Hello!

Thank you for the bug report.

This problem was fixed in 5.5.3 and we have no plans to backport the fix to 5.1. 
Therefore closing the bug as "Won't fix".