[MDEV-22460] safe_mutex: Found wrong usage of mutex 'LOCK_thd_data' and 'THR_LOCK_myisam', server with WSREP hangs Created: 2020-05-04  Updated: 2022-10-11  Resolved: 2022-10-11

Status: Closed
Project: MariaDB Server
Component/s: Galera, Storage Engine - MyISAM, wsrep
Affects Version/s: 10.4, 10.5
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Jan Lindström (Inactive)
Resolution: Cannot Reproduce Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-22154 safe_mutex: Trying to lock mutex at <... Closed
relates to MDEV-22458 Server with WSREP hangs after INSERT,... Closed

 Description   

Note: It is filed separately from MDEV-22458 for the sake of a different mutex combination, specific to MyISAM. The test case has send/reap, and thus may be non-deterministic. The concurrency is added as it seems to be necessary for producing the mutex error message, hang is reproducible without it. I suppose send/reap can be removed from the test case for the regression suite.

--source include/galera_cluster.inc
 
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
 
--connect (con1,localhost,root,,test)
--let $con1= `SELECT CONNECTION_ID()`
 
--connection default
--send
    INSERT INTO t1 VALUES (1),(2),(3),(4);
--connection con1
    INSERT INTO t1 VALUES (5),(6),(7),(8);
--connection default
--reap
--error ER_TARGET_NOT_EXPLAINABLE
eval SHOW EXPLAIN FOR $con1;
DROP TABLE t1;
--connection con1
SELECT 1;
 
# Cleanup
--disconnect con1

Server hangs upon SELECT. The error log shows this:

10.4 7f03a933

safe_mutex: Found wrong usage of mutex 'LOCK_thd_data' and 'THR_LOCK_myisam'
Mutex currently locked (in reverse order):
THR_LOCK_myisam                   /data/src/10.4/storage/myisam/mi_close.c  line 35
LOCK_thd_data                     /data/src/10.4/sql/sql_parse.cc  line 9017

Reproducible on 10.4, 10.5.
Not reproducible on 10.3.



 Comments   
Comment by Ramesh Sivaraman [ 2022-02-04 ]

jplindst Could not reproduce safe mutex wrong usage or wsrep SELECT hang issue on latest 10.4 build.

10.4.23 12cad0c3468d734e041d4ef0cd5a26d2a28606fc (Debug)

==============================================================================
 
TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------
 
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
connection node_2;
connection node_1;
CREATE TABLE t1 (a INT) ENGINE=MyISAM;
connect  con1,localhost,root,,test;
connection default;
INSERT INTO t1 VALUES (1),(2),(3),(4);
connection con1;
INSERT INTO t1 VALUES (5),(6),(7),(8);
connection default;
SHOW EXPLAIN FOR 17;
ERROR HY000: Target is not running an EXPLAINable command
DROP TABLE t1;
connection con1;
SELECT 1;
1
1
disconnect con1;
galera.safemutex5 'innodb'               [ pass ]   2037
--------------------------------------------------------------------------
The servers were restarted 0 times
Spent 2.037 of 20 seconds executing testcases
 
Completed: All 1 tests were successful.

Generated at Thu Feb 08 09:14:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.