Bug #50483 wrong mutex order: LOCK_global_system_variables and LOCK_active_mi
Submitted: 20 Jan 2010 19:03 Modified: 2 Jan 2012 18:45
Reporter: Sven Sandberg Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Replication Severity:S1 (Critical)
Version:6.0-codebase-bugfixing OS:Any
Assigned to: Libing Song CPU Architecture:Any
Tags: disabled, mutex order, ndb, regression, safe_mutex

[20 Jan 2010 19:03] Sven Sandberg
Description:
The following warning is found in the slave's log for rpl_ndb_binlog_format_errors in 6.0-codebase-bugfixing:

safe_mutex: Found wrong usage of mutex 'LOCK_global_system_variables' and 'LOCK_active_mi'

I have narrowed down the following necessary conditions to trigger the bug:

 - The slave receives a row event that it applies to a table that only supports statement logging (i.e., the slave uses storage engine EXAMPLE and the master uses some other storage engine).

 - NDB is loaded.

How to repeat:
==== rpl_ndb_bug-slave.opt ====
$EXAMPLE_PLUGIN_OPT

==== rpl_ndb_bug.test ====
--source include/have_binlog_format_row.inc
--source include/have_ndb.inc
--source include/ndb_master-slave.inc

CREATE TABLE t (a INT) ENGINE = MYISAM;
--sync_slave_with_master
DROP TABLE t;
INSTALL PLUGIN example SONAME 'ha_example.so';
CREATE TABLE t (a INT) ENGINE = EXAMPLE;

--connection master
INSERT INTO t VALUES (1);

--connection slave
# 1813 = ER_BINLOG_ROW_INJECTION_AND_STMT_ENGINE
--let $slave_sql_errno= 1813
--let $show_sql_error= 1
--source include/wait_for_slave_sql_error_and_skip.inc

--connection master
DROP TABLE  t;
--sync_slave_with_master
UNINSTALL PLUGIN example;
exit;
[20 Jan 2010 19:04] Sven Sandberg
See also BUG#40915
[20 Jan 2010 19:27] Sven Sandberg
In fact, it is not necessary to use the example storage engine. It's enough that we get any type of error in the SQL thread. Also, it doesn't matter if the master uses row-logging or statement-logging. It still seems that ndb is needed. Here's a simpler test case:

==== rpl_ndb_bug2.test ====
--source include/have_ndb.inc
--source include/ndb_master-slave.inc

# The warning is given with and without the following statement.
# SET @@session.binlog_format = STATEMENT;

CREATE TABLE t (a INT, PRIMARY KEY(a));
--sync_slave_with_master
INSERT INTO t VALUES (1);
--connection master
INSERT INTO t VALUES (1);

--connection slave
# 1062 = ER_DUP_ENTRY
--let $slave_sql_errno= 1062
--let $show_sql_error= 1
--source include/wait_for_slave_sql_error_and_skip.inc

--connection master
DROP TABLE  t;
--sync_slave_with_master
exit;
[21 Jan 2010 7:50] Sveta Smirnova
Thank you for the report.

Verified as described.
[11 Feb 2010 14:04] Alexander Nozdrin
The test case has been disabled due to this bug in 6.0-bugfixing.
[3 May 2011 14:28] MySQL Verification Team
can this bug cause a total hangup of server ?  aka new connections hanging in check_access() because they wait for LOCK_global_system_variables (5.1.x and 5.5.x) ?
[2 Jan 2012 18:45] Jon Stephens
Was found in 6.0 codebase which is no longer maintained. Could not reproduce in current mainline or Cluster trees. Closed.