Bug #5085 Crash when concurrent sessions lock/unlock tables
Submitted: 18 Aug 2004 11:14 Modified: 18 Sep 2004 14:53
Reporter: Yair dfwerfw Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version: 4.0.20a OS:Windows (Windows XP SP1)
Assigned to: CPU Architecture:Any

[18 Aug 2004 11:14] Yair dfwerfw
Description:
MySQL crashes when 2 concurrent sessions do the following, each on a different table:
ALTER TABLE t DISABLE KEYS
LOCK TABLES t WRITE
SET FOREIGN_KEY_CHECKS = 0
SET UNIQUE_CHECKS = 0
SET AUTOCOMMIT = 0
LOAD DATA INFILE "f" INTO TABLE t
SET UNIQUE_CHECKS = 1
SET FOREIGN_KEY_CHECKS = 1
UNLOCK TABLES
ALTER TABLE t ENABLE KEYS

When the LOCK TABLES / UNLOCK TABLES is removed from above sequence, MySQL does **not** crash

How to repeat:
Run above sequence in 2 or more concurrent sessions, each thread executing on a different table
[18 Aug 2004 13:16] Yair dfwerfw
The bug applies to innodb tables
[18 Aug 2004 14:53] MySQL Verification Team
I wasn't able to repeat. Could you please provide a complete
test case e.g: table schema, etc.

mysql> ALTER TABLE t DISABLE KEYS;
Query OK, 0 rows affected (0.00 sec)

mysql> LOCK TABLES t WRITE;
Query OK, 0 rows affected (0.01 sec)

mysql> SET FOREIGN_KEY_CHECKS = 0;
Query OK, 0 rows affected (0.00 sec)

mysql> SET UNIQUE_CHECKS = 0;
Query OK, 0 rows affected (0.00 sec)

mysql> SET AUTOCOMMIT = 0;
Query OK, 0 rows affected (0.00 sec)

mysql> LOAD DATA INFILE "t.txt" INTO TABLE t;
Query OK, 3 rows affected (0.01 sec)
Records: 3  Deleted: 0  Skipped: 0  Warnings: 0

mysql> SET UNIQUE_CHECKS = 1;
Query OK, 0 rows affected (0.01 sec)

mysql> SET FOREIGN_KEY_CHECKS = 1;
Query OK, 0 rows affected (0.00 sec)

mysql> UNLOCK TABLES;
Query OK, 0 rows affected (0.06 sec)

mysql> ALTER TABLE t ENABLE KEYS;
Query OK, 0 rows affected (0.00 sec)

Thanks.
[14 Feb 2005 22:54] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".