Bug #93282 Assertion `mp->count > 0 && my_thread_equal(my_thread_self(), mp->thread)'
Submitted: 22 Nov 2018 4:28 Modified: 24 Nov 2018 6:15
Reporter: Roel Van de Paar Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:8.0.12 OS:Any
Assigned to: CPU Architecture:Any

[22 Nov 2018 4:28] Roel Van de Paar
Description:
Ref 'How to Repeat'.

How to repeat:
Use an optimized/release build.

This bug is not straightforward to reproduce. The following testcase:

DROP DATABASE test;
CREATE DATABASE test;
USE test;
CREATE TABLE t1(c1 INT,c2 char(20)) ENCRYPTION="Y" ENGINE=MEMORY;
INSERT INTO t1 VALUES (0,'aaaaaaaa');
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (SLEEP(10),CONCAT('ev1_',CONNECTION_ID()));
CREATE EVENT ev2 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (SLEEP(3),CONCAT('ev2_',CONNECTION_ID()));
CREATE EVENT ev3 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (SLEEP(5),CONCAT('ev3_',CONNECTION_ID()));
CREATE EVENT ev4 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (SLEEP(1),CONCAT('ev4_',CONNECTION_ID()));
SELECT * FROM t1 LIMIT 2;
INSERT INTO t1 VALUES (0,'aaaaaaaa');
DROP DATABASE test;

Alternative queries instead of the DROP:

SELECT * FROM t1 LIMIT 2;
INSERT INTO t1 VALUES (0,'aaaaaaaa');

pasted into the CLI, can produce the issue, when a hang in the queries is combined with a simultaneous shutdown.

When the DROP, SELECT, or INSERT is happening, sometimes you will see the system hang for some time (wait 2+ minute to make sure it's hanging) 

(Maybe you can also use SHOW PROCESSLIST from another terminal to see all queries "Waiting for table level lock"). 

At that moment, run mysqladmin shutdown. Check the log for the crash. About 1 in every 10 runs orso you will see the crash. I had the best results crashing with the DROP hanging + mysqladmin shutdown at same time. The second best was the SELECT.
[22 Nov 2018 4:29] Roel Van de Paar
Shane, have a look.
[23 Nov 2018 9:16] MySQL Verification Team
I couldn't repeat assignment to co-worker for double check.
[23 Nov 2018 20:08] MySQL Verification Team
That assertion only affects debug builds, since it's called from safe_mutex_assert_owner which is defined as:

#ifdef SAFE_MUTEX
#define mysql_mutex_assert_owner(M) \
  safe_mutex_assert_owner((M)->m_mutex.m_u.m_safe_ptr);
#else
#define mysql_mutex_assert_owner(M) \
  {}
#endif

And on current windows source I also cannot repeat this on debug build.
Didn't bother trying 8.0.12-debug.
Let's see if others can verify.
[24 Nov 2018 6:15] MySQL Verification Team
I attempted ~20 times on 8.0.13/8.0.15-tr release/debug builds without luck. Please try with latest builds and let us know if you are still seeing this along with exact options used with the mysqld.