Bug #12845 | Stress test: Server crashes on CREATE .. SELECT statement | ||
---|---|---|---|
Submitted: | 29 Aug 2005 16:43 | Modified: | 15 Sep 2005 17:03 |
Reporter: | Alexey Stroganov | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server | Severity: | S2 (Serious) |
Version: | the latest 5.0.13pre | OS: | Linux (Linux) |
Assigned to: | Ingo Strüwing | CPU Architecture: | Any |
[29 Aug 2005 16:43]
Alexey Stroganov
[31 Aug 2005 8:51]
Ingo Strüwing
This is not exactly the same what I had lately, but it is also table locking related. The problem is that the select table t1 is dropped by another thread between the locking of t1 and opening the freshly created table t2. In open_table() this is detected as a refresh. Up to now, the open tables of the thread were closed and open_table() left with an error code. Normally this is a good thing, as all tables are opened in a row before any of them is locked. So the loop of opening all tables is restarted, until all succeed (or fail with a different error). But in create_table_from_items(), all select tables are already locked and there is no chance to repeat the opening of all tables. If open_table() closes all tables marked for refresh and returns with an error, the whole command fails. The bug in this situation is that the tables are still locked. The locks rely on data structures THR_LOCK_DATA, which are part of the table structure, which gets freed on close. At the end of each command, mysql_unlock_tables() is called and tries to access the freed data. (This might not crash on non-debug binaries as they do not re-initialize the freed memory.) I suggest a solution to this bug, which ignores the refresh of the tables in open_table(), when it is called from create_table_from_items(). The disadvantage of this solution is that the refreshing tread (drop table in this case) must wait until the CREATE ... SELECT command is complete. But since this would also be the case if the drop came after the newly created table was opened, the difference might be very small.
[31 Aug 2005 17:25]
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/internals/29122
[7 Sep 2005 8:27]
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/internals/29410
[7 Sep 2005 13:34]
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/internals/29426
[13 Sep 2005 12:37]
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/internals/29738
[13 Sep 2005 18:12]
Ingo Strüwing
Pushed the 5.0 version to 5.0.3.
[13 Sep 2005 18:20]
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/internals/29764
[15 Sep 2005 9:38]
Ingo Strüwing
Pushed version for 4.0 and 4.1 to 4.0.27 and 4.1.15.
[15 Sep 2005 17:03]
Paul DuBois
Noted in 4.0.27, 4.1.15, 5.0.13 changelogs.