[MDEV-29744] safe_mutex: Found wrong usage of mutex 'LOCK_commit_ordered' and 'LOCK_global_system_variables', or of mutex 'LOCK_global_system_variables' and 'LOCK_log', on setting max_binlog_size and START TRANSACTION Created: 2022-10-08  Updated: 2023-12-18

Status: Confirmed
Project: MariaDB Server
Component/s: Binary Protocol, Locking
Affects Version/s: 10.3, 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 11.0, 11.1, 11.2, 11.3, 11.4
Fix Version/s: 10.4, 10.5, 10.6, 10.11, 11.0, 11.1, 11.2, 11.3

Type: Bug Priority: Critical
Reporter: Roel Van de Paar Assignee: Andrei Elkin
Resolution: Unresolved Votes: 0
Labels: affects-tests, mutex


 Description   

# mysqld options required for replay: --log-bin
SET GLOBAL max_binlog_size=98304;  # A valid and arbritary setting
START TRANSACTION WITH CONSISTENT SNAPSHOT;

Leads to:

10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

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

And

# mysqld options required for replay: --log-bin
START TRANSACTION WITH CONSISTENT SNAPSHOT;
SET GLOBAL max_binlog_size=98304;  # A valid and arbritary setting

Leads to:

10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

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

Bug confirmed present in:
MariaDB: 10.3.37 (dbg), 10.4.27 (dbg), 10.5.18 (dbg), 10.6.10 (dbg), 10.7.6 (dbg), 10.8.5 (dbg), 10.9.3 (dbg), 10.10.2 (dbg), 10.11.0 (dbg)



 Comments   
Comment by Elena Stepanova [ 2022-10-14 ]

Also with binlog_checksum, as in

--source include/have_innodb.inc
--source include/have_log_bin.inc
 
SET GLOBAL binlog_checksum= CRC32;
START TRANSACTION WITH CONSISTENT SNAPSHOT;

The problem is old though.

Comment by Roel Van de Paar [ 2022-10-14 ]

Was able to catch a bit more info with this testcase

# mysqld options required for replay: --log-bin
SET GLOBAL max_binlog_size=0;
START TRANSACTION WITH CONSISTENT SNAPSHOT;

10.11.0 6ebdd3013a18b01dbecec76b870810329eb76586 (Debug)

safe_mutex: Found wrong usage of mutex 'LOCK_commit_ordered' and 'LOCK_global_system_variables'
Mutex currently locked (in reverse order):
LOCK_global_system_variables      /test/10.11_dbg/sql/sql_plugin.cc  line 3096
LOCK_commit_ordered               /test/10.11_dbg/sql/handler.cc  line 3007

Same source code line numbers for the testcase by elenst (with thanks!)

Comment by Roel Van de Paar [ 2023-12-07 ]

Also please try:

# mysqld options required for replay: --log-bin
START TRANSACTION WITH CONSISTENT SNAPSHOT;
FLUSH LOGS;
SET GLOBAL binlog_checksum=NONE;

11.3.0 126157061b4376496c034a809ea4943e863d1465 (Debug)

2023-12-07 15:08:21 0 [Note] /test/MD311023-mariadb-11.3.0-linux-x86_64-dbg/bin/mariadbd: ready for connections.
Version: '11.3.0-MariaDB-debug-log'  socket: '/test/MD311023-mariadb-11.3.0-linux-x86_64-dbg/socket.sock'  port: 10415  MariaDB Server
2023-12-07 15:08:21 6 [Note] Start binlog_dump to slave_server(2), pos(, 4), using_gtid(1), gtid('')
safe_mutex: Found wrong usage of mutex 'LOCK_global_system_variables' and 'LOCK_log'
Mutex currently locked (in reverse order):
LOCK_log                          /test/11.3_dbg/sql/log.cc  line 12235
LOCK_global_system_variables      /test/11.3_dbg/sql/sys_vars_shared.h  line 56

Comment by Roel Van de Paar [ 2023-12-18 ]

# mysqld options required for replay: --log-bin 
SET GLOBAL binlog_checksum=DEFAULT;
START TRANSACTION WITH CONSISTENT SNAPSHOT,READ WRITE;

safe_mutex: Found wrong usage of mutex LOCK_commit_ordered and LOCK_global_system_variables

Comment by Roel Van de Paar [ 2023-12-18 ]

Elkin Hi! Would you have a moment to check how serious this issue is under the hood? Thank you

Generated at Thu Feb 08 10:10:57 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.