Bug #18884 lock table + global read lock = crash
Submitted: 7 Apr 2006 12:02 Modified: 7 Jul 2006 19:02
Reporter: Sergei Golubchik Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Locking Severity:S3 (Non-critical)
Version:5.1 OS:
Assigned to: Konstantin Osipov CPU Architecture:Any

[7 Apr 2006 12:02] Sergei Golubchik
Description:
LOCK TABLE t1 WRITE;
FLUSH TABLES WITH READ LOCK;

lock.cc:1107: failed assertion `! (&LOCK_open)->count || ! pthread_equal(pthread_self(), (&LOCK_open)->thread)'

How to repeat:
see above, use debug build
[7 Jul 2006 19:02] Konstantin Osipov
I can't repeat it any more, tried both debug-max and valgrind-max builds:

mysql> LOCK TABLE t1 WRITE;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    2
Current database: test

ERROR 1146 (42S02): Table 'test.t1' doesn't exist
mysql> FLUSH TABLES WITH READ LOCK;
Query OK, 0 rows affected (0.01 sec)

mysql> create table t1 (a int);
ERROR 1223 (HY000): Can't execute the query because you have a conflicting read lock
mysql> unlock tables;
Query OK, 0 rows affected (0.00 sec)

mysql> create table t1 (a int);
Query OK, 0 rows affected (0.04 sec)

mysql> LOCK TABLE t1 WRITE;
Query OK, 0 rows affected (0.00 sec)

mysql> FLUSH TABLES WITH READ LOCK;
ERROR 1192 (HY000): Can't execute the given command because you have active locked tables or an active transaction
mysql> select current_user();
+----------------+
| current_user() |
+----------------+
| root@localhost | 
+----------------+
1 row in set (0.00 sec)

mysql> select version();
+-------------------+
| version()         |
+-------------------+
| 5.1.12-beta-debug | 
+-------------------+
1 row in set (0.00 sec)

mysql> 

I will add the test case to lock.test
[7 Jul 2006 20:26] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/8936