Bug #25908 corrupted myisam table crashes server even after repair

Submitted: 29 Jan 2007 10:15 Modified: 9 Apr 2007 19:40
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S2 (Serious)
Version:5.0.36BK OS:Any (*)
Assigned to: Sergey Vojtovich CPU Architecture:Any
Tags: bfsm_2007_02_01, corrupt, crash, myisam

[29 Jan 2007 10:15] Shane Bester
Description:
The server marks the table as crashed after check table is run.
then,repair table apparently repairs the table but mysqld crashes as soon as a select is done on it.

stack trace: (full stack in attached files)

memcpy
Protocol::net_store_data
Protocol::store_string_aux
Protocol_simple::store
Item_field::send
select_send::send_data
end_send
evaluate_join_record
sub_select
do_select
JOIN::exec()
mysql_select
handle_select
mysql_execute_command
mysql_parse
dispatch_command
do_command
handle_one_connection
pthread_start
_callthreadstart() 
_threadstart

How to repeat:
put the privately uploaded files into the test database

check table t1 extended;
check table t1 extended;
select * from t1;
repair table t1;
select * from t1;

Suggested fix:
improve the corruption detection of repair table/check table. don't crash.
[29 Jan 2007 10:16] Shane Bester
stack from windows mysqld-debug.exe crash

Attachment: 5.0.36_win32_stack.txt (text/plain), 3.00 KiB.

[29 Jan 2007 10:16] Shane Bester
stack from linux crash on 5.0.36BK

Attachment: 5.0.36_linux_stack.txt (text/plain), 2.77 KiB.

[7 Mar 2007 12:27] Sergey Vojtovich
The likely scenario that caused this bug is:
- This table was created by 4.0, that doesn't include complete fix for bug#6236 (likely prior to 4.0.25).
- Binary upgrade to 5.0, that doesn't include fix for bug#19192 (likely prior to 5.0.23).
- The table was altered using fast alter table code - .frm and .MYI got out of sync.
- Further table access crashes mysql server.

So as a result we have different column lengths (for varchars) in .MYI and .frm.
I plan to refuse to open such table by comparing .MYI and .frm definitions. This will also fix bug#24519.
[16 Mar 2007 14:30] 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/22140

ChangeSet@1.2481, 2007-03-16 18:30:04+04:00, svoj@mysql.com +1 -0
  BUG#25908 - corrupted myisam table crashes server even after repair
  
  Opening certain tables that have different definitions in .MYI and
  .frm may result in a server crash.
  
  Compare .MYI and .frm definition when myisam table is opened. In case
  definitions are diffirent refuse to open such table.
  
  No test case, since it requires broken table.
[21 Mar 2007 13:12] 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/22476

ChangeSet@1.2481, 2007-03-21 17:12:30+04:00, svoj@mysql.com +1 -0
  BUG#25908 - corrupted myisam table crashes server even after repair
  
  Opening certain tables that have different definitions in .MYI and
  .frm may result in a server crash.
  
  Compare .MYI and .frm definition when myisam table is opened. In case
  definitions are diffirent refuse to open such table.
  
  No test case, since it requires broken table.
[22 Mar 2007 10:43] Sergey Vojtovich
BUG#24519 was marked as duplicate.
[30 Mar 2007 17:28] Bugs System
Pushed into 5.1.18-beta
[9 Apr 2007 19:40] Paul DuBois
Noted in 5.1.18 changelog.

Corrupted MyISAM tables that have different definitions in the .frm
and .MYI tables might cause a server crash.

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.045 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.