Bug #22562 REPAIR TABLE .. USE_FRM causes server crash on Windows and server hangs on Linux
Submitted: 21 Sep 2006 17:53 Modified: 20 Oct 2006 17:47
Reporter: Victoria Reznichenko Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1,4.0 OS:Windows (Windows, Linux)
Assigned to: Sergey Vojtovich CPU Architecture:Any

[21 Sep 2006 17:53] Victoria Reznichenko
Description:
If you try to repair table that is located in the database different from the the default one MySQL server crashes on Windows and hangs on Linux:

1st connection:

mysql> repair table test.t1 use_frm;
+---------+--------+----------+--------------------------------+
| Table   | Op     | Msg_type | Msg_text                       |
+---------+--------+----------+--------------------------------+
| test.t1 | repair | error    | Table 'mysql.t1' doesn't exist |
+---------+--------+----------+--------------------------------+
1 row in set (0.00 sec)

mysql> repair table test.t1 use_frm;

2nd connection:

mysql> show processlist;
+----+------+-----------+-------+---------+------+---------------+------------------------------+
| Id | User | Host      | db    | Command | Time | State         | Info                         |
+----+------+-----------+-------+---------+------+---------------+------------------------------+
|  2 | root | localhost | mysql | Query   |  501 | Opening table | repair table test.t1 use_frm |
|  3 | root | localhost | NULL  | Query   |    0 | NULL          | show processlist             |
+----+------+-----------+-------+---------+------+---------------+------------------------------+
2 rows in set (0.00 sec)

I was able to reproduce it only with latest 4.1. Works fine for me with 5.0.

How to repeat:
1. create simple table in the database test:

create table t1(id int);
insert into t1 values(1),(2);

2. connect to MySQL server to the database mysql:

./bin/mysql -uroot mysql

3. Do REPAIR TABLE .. USE_FRM twice:

repair table test.t1 use_frm;
repair table test.t1 use_frm;
[22 Sep 2006 18:01] MySQL Verification Team
noticed 4.1.21 on w2k hangs with 100% cpu usage. sometimes hanged, and sometimes crashed. using debug binary this is printed to error log:

Error: Freeing unallocated data at line 836, '.\table.cpp'
Error: Freeing unallocated data at line 836, '.\table.cpp'
Error: Freeing unallocated data at line 836, '.\table.cpp'
[25 Sep 2006 9:43] Sergei Kulakov
Yes, I noticed the same thing on Windows 2000, MySql 4.0.15. Though, it just crashed a few times while it did repair the table the rest of the times.
[25 Sep 2006 9:45] Sergei Kulakov
P.S. But that must be because the database was the same most of the time, so, right, when the current database is different it crashes and when it is not it does well.
[27 Sep 2006 0:40] Trudy Pelzer
This problem may be related to bug#22053.
[11 Oct 2006 13:30] Sergey Vojtovich
This problem is not related to bug#22053.
[11 Oct 2006 15:32] 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/13512

ChangeSet@1.2529, 2006-10-11 20:34:20+05:00, svoj@mysql.com +3 -0
  BUG#22562 - REPAIR TABLE .. USE_FRM causes server crash on Windows and server
              hangs on Linux
  
  If REPAIR TABLE ... USE_FRM is issued for table that is located in different
  than default database server crash could happen.
  
  In reopen_name_locked_table take database name from table_list (user specified
  or default database) instead of from thd (default database).
  
  Affects 4.1 only.
[20 Oct 2006 9:18] Ingo Strüwing
Pushed to 5.1.13, 5.0.27, and 4.1.22.